|
|
вернуться в форумОбщий форумHi, i need the algorithm to do an euler path (+) I know the definition of a euler path, but i don't know how to implement it efficently, could someone help?, and tell me how is possible to do a the problem "Bus Routes" with only 49 k??.. (i see it in the list, is from someone from IFMO i belive). Mail: miguelangelhdz@hotmail.com Thanks in advance :) Re: Hi, i need the algorithm to do an euler path (+) Let St - stack; V1 - Odd vertex (or even, if graf has no odd) St=empty stack; Put V1 to St; while St not empty do begin V=St.top; //without extract from stack if there is an edge (V,i) then begin Put i to stack, remove edge (V,i) end else begin Write V to output remove V from St end; end; After such algorithm you have a Reversed Euler path in the output. Andrey Popyk. E-Mail: popyk@ief.tup.km.ua ICQ# 88914410 > I know the definition of a euler path, but i don't know how to > implement it efficently, could someone help?, and tell me how is > possible to do a the problem "Bus Routes" with only 49 k??.. (i see > it in the list, is from someone from IFMO i belive). > Mail: miguelangelhdz@hotmail.com > Thanks in advance :) |
|
|