Binary Tree Fundamentals
- 15Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
What defines a full binary tree?
What defines a full binary tree?
15 questions
- 1
What defines a full binary tree?
- A
Every node must have exactly two children.
- B
All levels are completely filled.
- C
Node: either 0 or 2 children.
- D
All leaves are at the same depth.
Correct answer
CNode: either 0 or 2 children.
Explanation
In a full binary tree, nodes have either 0 or 2 children; no node has exactly one child.
- A
- 2
How are nodes arranged in a complete binary tree?
- A
Each node has two children.
- B
All leaves are on the same level.
- C
Filled top-to-bottom, left-to-right.
- D
No node has a single child.
Correct answer
CFilled top-to-bottom, left-to-right.
Explanation
A complete binary tree is filled level by level from left to right, except possibly the last level.
- A
- 3
Which properties must a perfect binary tree satisfy?
- A
It must be complete but not necessarily full.
- B
It must be full and complete.
- C
All nodes must have exactly one child.
- D
It must be full but not necessarily complete.
Correct answer
BIt must be full and complete.
Explanation
A perfect binary tree has all leaves on the same level and every internal node has two children, making it both full and complete.
- A
- 4
If a node in a full binary tree has children, how many does it have?
- A
Exactly two
- B
Exactly one
- C
Either one or two
- D
None
Correct answer
AExactly two
Explanation
In a full binary tree, any node that has children must have exactly two children.
- A
- 5
What is the order of operations in a pre-order traversal?
- A
Node, right subtree, left subtree
- B
Node, left subtree, right subtree
- C
Left subtree, right subtree, node
- D
Left subtree, node, right subtree
Correct answer
BNode, left subtree, right subtree
Explanation
Pre-order visits the current node first, then recursively traverses the left subtree, then the right subtree.
- A
- 6
In an in-order traversal, when is the node visited?
- A
Before its left subtree
- B
After both subtrees
- C
Between its left and right subtrees
- D
After its right subtree
Correct answer
CBetween its left and right subtrees
Explanation
In in-order, we traverse left, visit the node, then traverse right.
- A
- 7
In a post-order traversal, the node is visited:
- A
Only if it is a leaf
- B
Before both subtrees
- C
Between left and right subtrees
- D
After both subtrees
Correct answer
DAfter both subtrees
Explanation
Post-order traverses left, then right, then visits the node.
- A
- 8
The prefix 'pre' in 'pre-order' indicates that the node is visited:
- A
Only if it has children
- B
At the end of the traversal
- C
Before both subtrees
- D
After the left subtree
Correct answer
CBefore both subtrees
Explanation
The prefix tells when the node is visited relative to the subtrees: 'pre' means before.
- A
- 9
What order does an in-order traversal produce on a binary search tree?
- A
Alternating pattern
- B
Increasing order
- C
Decreasing order
- D
Leaves first
Correct answer
BIncreasing order
Explanation
In-order traversal of a BST visits nodes in sorted (non-decreasing) order.
- A
- 10
What is the defining property of a binary search tree?
- A
It is a complete binary tree.
- B
For each node, all left descendants are smaller and all right descendants are larger.
- C
Every node has at most one child.
- D
It is a full binary tree.
Correct answer
BFor each node, all left descendants are smaller and all right descendants are larger.
Explanation
In a BST, the left subtree of a node contains only keys less than the node's key, and the right subtree contains only keys greater than the node's key.
- A
- 11
In a recursive tree traversal, what does each stack frame represent?
- A
The traversal order
- B
The recursion depth
- C
The entire tree
- D
A single node and its tasks (visit, left, right)
Correct answer
DA single node and its tasks (visit, left, right)
Explanation
Each recursive call corresponds to a node, and the stack frame stores the tasks (visit, left, right) for that node.
- A
- 12
What is the time complexity of traversing a binary tree with n nodes?
- A
O(n^2)
- B
O(log n)
- C
O(1)
- D
O(n)
Correct answer
DO(n)
Explanation
Since every node is visited exactly once, the time complexity is linear, O(n).
- A
- 13
Which data structure is typically used for an iterative depth-first tree traversal?
- A
Heap
- B
Queue
- C
Stack
- D
Linked list
Correct answer
CStack
Explanation
An iterative depth-first traversal (pre, in, post) can be implemented using an explicit stack to simulate recursion.
- A
- 14
Which data structure is commonly used for a breadth-first traversal of a tree?
- A
Stack
- B
Queue
- C
Priority queue
- D
Array
Correct answer
BQueue
Explanation
Breadth-first traversal (level-order) typically uses a queue to process nodes level by level.
- A
- 15
In a recursive tree traversal, where is the state of the recursion stored?
- A
In the heap
- B
In the call stack
- C
In a global variable
- D
In a queue
Correct answer
BIn the call stack
Explanation
Recursive calls store their state (parameters, local variables) on the call stack.
- A

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