Mayor Problem; universal sink
3 posters
Page 1 of 1
Mayor Problem; universal sink
Ina city mayor elections wer der.....so ppl decided to choose such a person so that all ppl know him but that person does not know anyone....write an algo to find that person
shivang- Posts : 42
Join date : 2009-01-30
Age : 35
@shivang
construct a graph node which is pointed by every node and no node is pointed by it
am i right?????
am i right?????
mnnit.rahul- Posts : 51
Join date : 2009-02-01
@Etawah
Ya u r right....got the logic...same as universal sink....
shivang- Posts : 42
Join date : 2009-01-30
Age : 35
Re: Mayor Problem; universal sink
Ya it's the same universal sink problem ... in maximum of 2n traversal in the array representation of list u can find the solution.
Beagle- Posts : 40
Join date : 2009-01-30
Re: Mayor Problem; universal sink
answer is o(n) but not in 2n
also there are two cases
1) represent graph as array
2) graph is represented as linklist
also there are two cases
1) represent graph as array
2) graph is represented as linklist
mnnit.rahul- Posts : 51
Join date : 2009-02-01
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|