1.

What is the complexity of adding an element to the heap.(a) O(log n)(b) O(h)(c) O(log n) & O(h)(d) O(n)Asked question is from Heap topic in division Heap of Data Structures & Algorithms IThe question was posed to me during an interview.

Answer»

Right option is (c) O(log n) & O(h)

The best I can explain: The total POSSIBLE OPERATION in re LOCATING the new LOCATION to a new element will be equal to HEIGHT of the heap.



Discussion

No Comment Found

Related InterviewSolutions