A binary search tree is a binary tree with the added property that the left child is
less than the parent, which is less than or equal to the ___________.
A. Left child
The definition of a binary search tree is an extension of the definition of a
______________.
A. stack
Each BinaryTreeNode object maintains a reference to the element stored at that
node as well as references to each of the node’s __________.
D. None of the above
In removing an element from a binary search tree, another node must be
___________ to replace the node being removed.
A. duplicated
The leftmost node in a binary search tree will contain the __________ element,
while the rightmost node will contain the __________ element.
A. Maximum, minimum
One of the uses of trees is to provide _________ implementations of other
collections.
D. None of the above
If a binary search tree is not __________, it may be less efficient than a linear
structure.
A. complete
The height of the right subtree minus the height of the left subtree is called the
___________ of a node.
A. height
The balance restriction on a red/black tree is somewhat less strict than that for
AVL trees. However, in both cases, the find operation is order ______.
A. n
The Java Collections API provides two implementations of balanced binary
search trees, TreeSet and TreeMap, both of which use a ___________tree
implementation.
A. AVL
child is less than the parent, which is less than or equal to the right child.
binary tree.
In removing an element from a binary search tree, another node must be
element, while the __<rightmost>__ node will contain the maximum element.
collections.
linear structure.
The height of the right subtree minus the height of the left subtree is called the
There are only two ways that a tree, or any subtree of a tree, can become
node.
The Java Collections API provides two implementations of balanced binary
red/black tree implementation.
left child is greater than the parent, which is less than or equal to the right child.
of a binary tree.
stored at that node as well as references to each of the node’s children.
must be demoted to replace the node being removed.
element, while the rightmost node will contain the maximum element.
other collections.
linear structure.
called the balance factor of a node.
become unbalanced: through the insertion of a node or through the deletion of a
node.
than that for AVL trees. However, in both cases, the find operation is order n.
What is the difference between a binary tree and a binary search tree?
Why are we able to specify addElement and removeElement operations for a
binary search tree but we were unable to do so for a binary tree?
Assuming that the tree is balanced, what is the time complexity (order) of the
addElement operation?
Without the balance assumption, what is the time complexity (order) of the
addElement operation?
As stated in this chapter, a degenerate tree might actually be less efficient than
a linked list. Why?
Our removeElement operation uses the inorder successor as the replacement
for a node with two children. What would be another reasonable choice
for the replacement?
The removeAllOccurences operation uses both the contains and
removeElement operations. What is the resulting time complexity (order)
for this operation?
RemoveFirst and first were O(1) operations for our earlier implementation of an
ordered list. Why are they less efficient for our
BinarySearchTreeOrderedList?
Why does the BinarySearchTreeOrderedList class have to define the iterator
method? Why can it not just rely on the iterator method of its parent class
like it does for size and isEmpty?
What is the time complexity of the addElement operation after modifying to
implement an AVL tree?
What imbalance is fixed by a single right rotation?
What imbalance is fixed by a leftright rotation?
What is the balance factor of an AVL tree node?
In our discussion of the process for rebalancing an AVL tree, we never
discussed the possibility of the balance factor of a node being either +2
or –2 and the balance factor of one of its children being either +2 or –2.
Why not?
Rebalancing an AVL tree is done after either an insertion or a deletion
and it is done starting at the affected node and working up along a
We noted that the balance restriction for a red/black tree is less strict than that
of an AVL tree and yet we still claim that traversing the longest path in a
red/black tree is still O(log n). Why?
Since no red node can have a red child, then at most half of the nodes
What is the difference between a TreeSet and a TreeMap?