# The procedure FindMin() to find the minimum element and the procedure DeleteMin() to delete the minimum element in min heap take _________

Category: QuestionsThe procedure FindMin() to find the minimum element and the procedure DeleteMin() to delete the minimum element in min heap take _________
Editor">Editor Staff asked 5 months ago

The procedure FindMin() to find the minimum element and the procedure DeleteMin() to delete the minimum element in min heap take _________

(a) logarithmic and linear time constant respectively

(b) constant and linear time respectively

(c) constant and quadratic time respectively

(d) constant and logarithmic time respectively

The origin of the question is Heap topic in chapter Heap of Data Structures & Algorithms I

This question was posed to me in exam.

Editor">Editor Staff answered 5 months ago

The correct option is (d) constant and logarithmic time respectively

The best I can explain: In the min heap, the root is the maximum element in the tree. So, locating it takes constant time, but deleting it takes logarithmic time. Because after deleting it, the root is replaced with last element and then the procedure to maintain the min ordering is invoked.

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40701