create a tournament tree.in each round one value is eliminated to obtain in
the process the winner or the highest value in n-1 comparisons. Then check
the queue of the winner which contains log(n) entries of the values beaten
by the winner which implicitly will contain the runners up.Then log(n)-1
comparisons to find the highest among all the losers whom the winner had
beaten. So all over complexity will be n-1 +log(n) -1 = n+log(n)-2. Hp that
answers ur query. nice question btw :)

On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI <viharri....@gmail.com> wrote:

> hey i'm also thinking n + logn -2.. but couldnt able to figure out
> how??? can you please explain the logic
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to