[algogeeks] Re: optimum algo for second largest

2009-10-12 Thread Shishir Mittal
On Mon, Oct 12, 2009 at 1:29 PM, ankur aggarwal ankur.mast@gmail.comwrote: @shishir can u give the ds data structure used is a binary tree, with each node key being the maximum of its two children's key values. Space complexity of implementation of tournament principle is O(n). how would

[algogeeks] Re: optimum algo for second largest

2009-10-12 Thread ankur aggarwal
in that case it is ok.. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to

[algogeeks] Re: optimum algo for second largest

2009-10-11 Thread Manisha
First find out the largest element and it requires n-1 comparison. Lets say we have 8 elements then we need 7 comparison to decide largest. Imagine the tree structure that you will use to find out largest. 21 15 21

[algogeeks] Re: optimum algo for second largest

2009-10-11 Thread Shishir Mittal
It has been discussed here http://groups.google.com/group/algogeeks/browse_thread/thread/5a3ccc1bfb4617fa/885438e251ffd330?lnk=gstq=second+highest+element#885438e251ffd330 On Sun, Oct 11, 2009 at 8:21 PM, Manisha pgo...@gmail.com wrote: First find out the largest element and it requires n-1