Re: [algogeeks] Re: PLease suggest the Algo for this problem

2013-05-27 Thread Karan Sewani
Create a BST from given list such that team that has won should be right child of node and and teams that has lost should be left child of node and then traverse the tree in reverse in order. Karan On Thu, May 23, 2013 at 10:58 PM, bharat b bagana.bharatku...@gmail.com wrote: @Don : you are

[algogeeks] Re: PLease suggest the Algo for this problem

2013-05-23 Thread Don
This is not necessarily possible. If you have teams A, B, and C, it is possible that A beat B B beat C C beat A. Based on the first two games the ranking should be A,B,C. But based on the third game, C should be ranked higher than A. Don On May 23, 11:06 am, Nishant Pandey

Re: [algogeeks] Re: PLease suggest the Algo for this problem

2013-05-23 Thread Nishant Pandey
@DON, For example if in a particular order, the teams appeared as T1, T2, T3, T4 … then team T1 had lost to T2, T2 had lost to T3, and T3 had lost to T4… It may be possible that T3 lost to T1 .. but that need not be taken into consideration while writing the order. Only the neighboring elements

Re: [algogeeks] Re: PLease suggest the Algo for this problem

2013-05-23 Thread bharat b
http://www.careercup.com/question?id=14804702 On Thu, May 23, 2013 at 8:53 PM, Nishant Pandey nishant.bits.me...@gmail.com wrote: @DON, For example if in a particular order, the teams appeared as T1, T2, T3, T4 … then team T1 had lost to T2, T2 had lost to T3, and T3 had lost to T4… It may

[algogeeks] Re: PLease suggest the Algo for this problem

2013-05-23 Thread Don
If you create a directed graph where each node is a team and an edge exists from A-B if A lost to B, then find a Hamiltonian Path in the graph. That path will be the sequence you need. Don On May 23, 12:02 pm, bharat b bagana.bharatku...@gmail.com wrote:

Re: [algogeeks] Re: PLease suggest the Algo for this problem

2013-05-23 Thread bharat b
@Don : you are correct but hamiltanion path problem is NPC right? quicksort algorithm is good solution. I already shared algorithm in above link. On Thu, May 23, 2013 at 10:25 PM, Don dondod...@gmail.com wrote: If you create a directed graph where each node is a team and an edge exists from