For the binary tree with root A, children B and C, B's children D and E, and C's right child F, which sequence is the postorder traversal?
07 Trees and Binary Search Trees Online Quiz Questions
Use this free practice quiz with 20 questions to review 07 Trees and Binary Search Trees, test your knowledge, and prepare for your next test or exam.
True or false: The running time of a traversal remains Θ(n) even when the tree is completely skewed.
- A
True
- B
False
What term identifies the top node of a tree?
In the tree with A at the root, B and C beneath it, and D and E beneath B plus F beneath C, the tree has height and D, E, and F are .
When deleting a node with two children from a binary search tree, which replacement choices preserve the ordering property? Select all that apply.
- A
The inorder successor
- B
The root of the entire tree in every case
- C
The inorder predecessor
- D
Any key from the right subtree
In the BST whose root is 8, with 3 as its left child, 10 as its right child, 6 as 3's right child, and 7 as 6's right child, which path does a search for 7 follow?
- A
8 → 10 → 14
- B
8 → 3 → 1
- C
8 → 3 → 6 → 7
- D
8 → 3 → 6 → 4
True or false: A balanced binary search tree must have subtrees of exactly equal size at every internal node.
- A
True
- B
False
A tree has root 10, left child 8, 8's left child 5, and 5's left child 3. What is the tree height, measured in edges?
In a binary search tree, traversal produces the keys in ascending order.
Which descriptions correctly state classifications or defining properties of binary trees? Select all that apply.
- A
Every node has either zero or two children.
- B
The final level, if incomplete, is filled from left to right.
- C
Every internal node has two children and all leaves share one depth.
- D
Most nodes have only one child, making the tree resemble a linked list.
Explain how deletion works in a binary search tree for each of the three cases: a leaf, a node with one child, and a node with two children. For the two-child case, state which replacement keys may be used and why the replacement preserves the BST property.
A binary search tree is formed by inserting already sorted keys, creating a chain of n nodes. What is the worst-case running time of searching for a key?
- A
Θ(log n)
- B
Θ(n)
- C
Θ(1)
- D
Θ(n log n)
A binary tree has at least one node with exactly one child. Which statement correctly describes the full-binary-tree property for this tree?
- A
The full-tree property is satisfied.
- B
The full-tree property is violated.
- C
The perfect-tree property is satisfied.
- D
The tree is a forest.
What is the degree of a leaf node?
- A
1
- B
2
- C
0
- D
The height of the tree
In the binary search tree with root 8, right child 10, and right grandchild 14, which key is the inorder successor of 8?
- A
10
- B
14
- C
7
- D
3
What is the running time of a complete tree traversal for a tree with n nodes, whether the tree is balanced or skewed?
- A
Θ(log n)
- B
Θ(n)
- C
Θ(1)
- D
Θ(n²)
Which property must a valid BST rotation preserve?
- A
The inorder sequence of keys
- B
The exact depth of every node
- C
The number of children of every node
- D
The insertion order of the keys
True or false: A node that is three edges below the root has depth 3.
- A
True
- B
False
A completely skewed tree contains 8 nodes, with each node except the last having one child. What is the tree's height, measured in edges?
In a binary search tree, from which child reference should you repeatedly continue to find the maximum key?