Question: We discussed an implementation of a min priority queue as a min heap, which had two key properties. 1 . The min heap property: the

We discussed an implementation of a min priority queue as a min heap, which had two key properties.
1. The min heap property: the key at a node is at most the keys of its children.
2. The heap is represented by a complete binary tree.
What is the purpose of the complete binary tree property? Select all that apply
1. It ensures that the minimum key is at the root of the tree.
2. It allows a simple representation of the tree by a vector in a memory efficient manner
3. It permits us to tell if a given key is contained in the heap in time O(log n).
4. When the heap has n elements it insures that the height of the tree is at most log n, which in turn means push and pop can be done in time O(log n).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!