[algogeeks] Number of Comparisons!

2011-07-02 Thread Nitish Garg
How many comparisons are necessary to find the largest and smallest of a set of n distinct elements? Let's discuss it for n = 10 and maybe we can generalize it from there. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this

Re: [algogeeks] Number of Comparisons!

2011-07-02 Thread udit sharma
If n is odd, then we perform 3*n/2 comparisons. If n is even, we perform 1 + 3*(n-2)/2 -- Regards UDIT DU- MCA -- 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