1.

In what time can a binary heap be built?(a) O(N)(b) O(N log N)(c) O(log N)(d) O(N^2)I got this question in an interview.The doubt is from Heapsort in section Sorting of Data Structures & Algorithms II

Answer»

The CORRECT answer is (a) O(N)

The best I can explain: The BASIC STRATEGY is to build a binary heap of N ELEMENTS which takes O(N) TIME.



Discussion

No Comment Found

Related InterviewSolutions