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.
The min heap property: the key at a node is at most the keys of its children.
The heap is represented by a complete binary tree.
What is the purpose of the complete binary tree property? Select all that apply
It ensures that the minimum key is at the root of the tree.
It allows a simple representation of the tree by a vector in a memory efficient manner
It permits us to tell if a given key is contained in the heap in time Olog n
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 Olog n
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
