Question

Consider a min-heap represented as an array: [1, 3, 5, 7, 9]. If the element 2 is inserted into this min-heap, what will be the state of the heap array after the insertion and heapify-up operation?

A [1, 2, 5, 7, 9, 3] Correct Answer Incorrect Answer
B [1, 3, 2, 7, 9, 5] Correct Answer Incorrect Answer
C [1, 2, 3, 7, 9, 5] Correct Answer Incorrect Answer
D [2, 1, 5, 7, 9, 3] Correct Answer Incorrect Answer
E [1, 3, 5, 7, 9, 2] Correct Answer Incorrect Answer

Solution

The correct answer is B

Practice Next
ask-question