Binary Tree Algorithms
- 22Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
22 questions
- 1In a tree, the circles that store values are called_____.
Hint
Think about the basic components that hold data.
Answer
nodes
- 2The lines connecting nodes in a tree are called_____.
Hint
These represent the relationships between nodes.
Answer
edges
- 3A node that has no parent is called the_____.
Hint
This is the topmost node in a tree.
Answer
root
- 4A node that has no children is called a_____.
Hint
It is at the end of a branch.
Answer
leaf
- 5In a tree, if node B is a child of node A, then node A is the_____of node B.
Hint
Think of family relationships.
Answer
parent
- 6A binary tree is a tree where every node has at most_____children.
Hint
The word 'binary' relates to the number two.
Answer
two
- 7A binary tree must have exactly one_____.
Hint
The node with no parent.
Answer
root
- 8In a binary tree, there is exactly one_____between the root and any node.
Hint
A sequence of connected nodes.
Answer
path
- 9A tree with zero nodes, called the empty tree, is considered a_____.
Hint
Even without nodes, it still satisfies the definition.
Answer
binary tree
- 10For a node that does not have a left child, its_____
leftproperty is set to.Hint
A placeholder for no child.
Answer
null
- 11The depth-first traversal algorithm uses a_____data structure.
Hint
Last-in, first-out order.
Answer
stack
- 12In a recursive depth-first traversal, the base case for a null node is to_____.
Hint
No further action needed.
Answer
return
- 13The time complexity of a depth-first traversal on a binary tree with n nodes is_____.
Hint
It visits each node exactly once.
Answer
O(n)
- 14The breadth-first traversal algorithm uses a_____data structure.
Hint
First-in, first-out order.
Answer
queue
- 15Breadth-first traversal cannot be easily implemented_____due to its reliance on a queue.
Hint
Recursion naturally uses a stack.
Answer
recursively
- 16In the "tree includes" problem, if the root is null, the function should return_____.
Hint
Cannot find anything in an empty tree.
Answer
false
- 17In the recursive solution for "tree includes", the base case for a non-null node that matches the target is to return_____.
Hint
Found it.
Answer
true
- 18In the recursive "tree includes", after checking the node value, the result is the logical_____of the left subtree and right subtree results.
Hint
At least one side must contain the target.
Answer
OR
- 19In the recursive tree sum function, the base case for a null node returns_____.
Hint
Empty tree has no value.
Answer
0
- 20In the recursive tree min value function, the base case for a null node returns_____.
Hint
A very large number that will never be the minimum.
Answer
Infinity
- 21In the max root-to-leaf path sum problem, a leaf node returns its own value as the_____.
Hint
A leaf is the end of a path.
Answer
max path sum
- 22For a null node in the max root-to-leaf path sum, the appropriate return value is_____.
Hint
It should never be chosen over a real path.
Answer
-Infinity

Ask anything
We've read this whole study set, so questions about it get the best answers.