MCQ
Single Best Answer
Easy
QWhat is the time complexity of a delete operation in a binary heap in the worst case?
ID: #15265
Time Complexity
182 views
Question Info
#15265Q ID
EasyDifficulty
Time ComplexityTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer: Option B
Explanation
In a binary heap, the delete operation removes the root element, which is typically the minimum or maximum element depending on the heap's type. After removing the root, the heap needs to restore the heap property by percolating down or up, which involves swapping elements and comparing them with their children or parent. As the height of a binary heap is logarithmic to the number of elements (n), the worst-case time complexity of a delete operation is O(log n).
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic