This will,I guss take 3N/2 comparison, for N + Lg -2.
Find Max(Winner) in N-1 (Tournament Method)
Compare Looser(fron Winner) For every Round with The Looser(from Winner) of
previous round..
_Negi
highest2=a[1];
> for(i=1;i<5;i++)
> {
> if( a[i] > highest1)
> {
> highest2 = highest1;
> highest1 = a[i];
> flag++;
> }
> else if( a[i] > highest2 )
> {
> highest2 = a[i];
> flag++;
> }
> else
> flag++;
> }
>
> if( !flag )
> highest2 = highest1;
>
> printf("%d",highest2);
> }
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---