The ascending heap property is ___________

Category: QuestionsThe ascending heap property is ___________
Editor">Editor Staff asked 4 weeks ago

The ascending heap property is ___________
(a) A[Parent(i)] =A[i]
(b) A[Parent(i)] <= A[i]
(c) A[Parent(i)] >= A[i]
(d) A[Parent(i)] > 2 * A[i]
My doubt is from Heap in portion Heap of Data Structures & Algorithms I
I have been asked this question in unit test.

1 Answers
Editor">Editor Staff answered 4 weeks ago

Right answer is (b) A[Parent(i)] <= A[i]
Best explanation: The min heap is also known as ascending heap. Min heap of size n is an almost complete binary tree of n nodes such that the element at each node is greater than or equal to the element at its parent node.