+1 vote
in Data Structures & Algorithms I by (88.2k points)
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^2

Question is from Weak Heap topic in chapter Heap of Data Structures & Algorithms I

The question was posed to me in an interview.

1 Answer

+1 vote
by (672k points)
selected by
 
Best 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.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...