1.

The total comparisons in finding both smallest and largest elements are(a) 2*n +2(b) n + ((n+1)/2) -2(c) n+logn(d) n^2Question is from Weak Heap topic in chapter Heap of Data Structures & Algorithms IThe question was posed to me in an interview.

Answer»

The CORRECT option is (b) N + ((n+1)/2) -2

The best explanation: The total COMPARISONS in FINDING smallest and LARGEST elements is n + ((n+1)/2) – 2.



Discussion

No Comment Found

Related InterviewSolutions