+1 vote
in Data Structures & Algorithms I by (88.2k points)
The worst case complexity of deleting any arbitrary node value element from heap is __________

(a) O(logn)

(b) O(n)

(c) O(nlogn)

(d) O(n^2)

My question is taken from Heap topic in chapter Heap of Data Structures & Algorithms I

This question was posed to me in an interview for internship.

1 Answer

+1 vote
by (672k points)
selected by
Best answer
The correct choice is (a) O(logn)

Easy explanation - The total possible operation in deleting the existing node and re locating new position to all its connected nodes will be equal to height of the heap.

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.