A minheap is a complete binary tree in which each node is less than or equal to
both the left child and the right child.
D. Binary search tree
A minheap stores its smallest element at the ________ of the binary tree.
D. Binary search trees
The __________ method adds a given Comparable element to the appropriate
location in the heap, maintaining both the completeness property and the
ordering property of the heap.
A. add
Since a heap is a complete tree, there is only one correct location for the
insertion of a new node, and that is either the next open position from the left at
level h or the first position on the left at level h+1 if level h is full.
A. Minheap
Typically, in heap implementations, we keep track of the position of the last node
or, more precisely, the last leaf in the tree.
A. root
To maintain the completeness of the tree, there is only one valid element to
D. tree
Though not a queue at all, a minheap provides an efficient implementation of a
_____________.
D. None of the above
Because of the requirement that we be able to traverse up the tree after an
insertion, it is necessary for the nodes in a heap to store a pointer to their
________.
A. children
In an array implementation of a binary tree, the root of the tree is in position 0,
and for each node n, n’s left child is in position ________ and n’s right child is in
position ________.
A. 2n + 1
B. 2n + 2
The addElement operation for both the linked and array implementations is
O(__________).
A. n
The removeMin operation for both the linked and array implementations is O(log
n). A. n
The __________ method consists of adding each of the elements of the list to a
heap and then removing them one at a time.
D. None of the above
Heap sort is O(________).
A. n
A minheap is a complete __<binary>__ tree in which each node is less than or
equal to both the left child and the right child.
appropriate location in the heap, maintaining both the completeness property and
the ordering property of the heap.
insertion of a new node, and that is either the next open position from the left at
level h or the first position on the left at level h+1 if level h is full.
last node or, more precisely, the last leaf in the tree.
to replace the root, and that is the element stored in the last leaf in the tree.
implementation of a priority queue.
Because of the requirement that we be able to traverse up the tree after an
insertion, it is necessary for the nodes in a heap to store a pointer to their
In an array implementation of a binary tree, the root of the tree is in position 0,
True/False. A minheap is a complete binary tree in which each node is less than
or equal to both the left child and the right child.
and both children of the root of a minheap are also minheaps.
appropriate location in the heap, maintaining both the completeness property and
the ordering property of the heap.
location for the insertion of a new node, and that is either the next open position
from the left at level h or the first position on the left at level h+1 if level h is full.
the last node or, more precisely, the last leaf in the tree.
element to replace the root, and that is the element stored in the first leaf in the
tree.
True/False. Though not a queue at all, a minheap provides an efficient
implementation of a priority queue.
after an insertion, it is necessary for the nodes in a heap to store a pointer to their
parent.
position 0, and for each node n, n’s left child is in position 2(n+1) and n’s right
child is in position 2(n+2).
implementations is O(n log n).
implementations is O(log n).
True/False. The heapSort method consists of adding each of the elements of
the list to a heap and then removing them one at a time.
What is the difference between a heap (a minheap) and a binary search tree?
What is the difference between a minheap and a maxheap?
What does it mean for a heap to be complete?
Does a heap ever have to be rebalanced?
The addElement operation for the linked implementation must determine the
parent of the next node to be inserted. Why?
Why does the addElement operation for the array implementation not have to
determine the parent of the next node to be inserted?
The removeMin operation for both implementations replaces the element at the
root with the element in the last leaf of the heap. Why is this the proper
replacement?
What is the time complexity of the addElement operation?
What is the time complexity of the removeMin operation?
For both implementations, the removeMin operation is O(log n).
What is the time complexity of heap sort?