Friday, 12 June 2015

Q34,paper 3,D13. _________ comparisons are necessary in the worst case to find both the maximum and minimum of n numbers.



(A) 2n – 2

(B) n + floor (lg n) – 2

(C) floor (3n/2)- 2

(D) 2 lg n – 2



Answer C

Tournament method of  finding max and min needs of 3n/2 -2 comparisons


No comments:

Post a Comment

Note: only a member of this blog may post a comment.