Introduction to Trees
- 28Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
28 questions
- 1Tree is a_____data structure, unlike linked lists which are linear.
Hint
Consider how nodes can connect to multiple other nodes.
Answer
non-linear
- 2In a binary tree, each node can have at most_____children.
Hint
The prefix 'bi-' indicates this number.
Answer
two
- 3In an n-ary tree, multiple children of a node are typically stored in a_____of type
node*.Hint
A dynamic array-like structure for storing multiple elements.
Answer
list
- 4A binary tree node contains data, a left pointer, and a_____pointer.
Hint
The two pointers point to the two possible children.
Answer
right
- 5The topmost node from which the tree originates is called the_____.
Hint
It is the starting point of the tree.
Answer
root
- 6A node directly connected below another node is called its_____.
Hint
It is the opposite of parent.
Answer
child
- 7The node above a child is called its_____.
Hint
It is the node that is directly connected above.
Answer
parent
- 8Nodes that share the same parent are called_____.
Hint
They are like brothers/sisters in a family tree.
Answer
siblings
- 9All nodes that appear above a given node on the path to the root are called its_____.
Hint
Think of lineage; these are the nodes before the given node.
Answer
ancestors
- 10All nodes that appear below a given node are called its_____.
Hint
Think of future generations in a family tree.
Answer
descendants
- 11A node with no children is called a_____node.
Hint
It is at the end of a branch.
Answer
leaf
- 12In the recursive_____
buildTreefunction, a base case returns NULL when the input data equals.Hint
This value acts as a sentinel indicating no node.
Answer
-1
- 13In the recursive_____
buildTreefunction, after creating the root node from input data, the function recursively builds thesubtree first.Hint
The function asks for data for left insertion before right.
Answer
left
- 14The_____
buildTreefunction returns a pointer to theof the tree.Hint
It is the topmost node.
Answer
root
- 15In level order traversal, a_____is used to process nodes level by level.
Hint
This data structure operates in FIFO order.
Answer
queue
- 16In level order traversal with level separation, a_____is pushed into the queue to mark the end of a level.
Hint
It is a special value indicating no node.
Answer
NULL
- 17In inorder traversal, the order of operations is: left subtree,_____, right subtree.
Hint
The 'N' in LNR stands for this.
Answer
node
- 18In preorder traversal, the node is visited_____the left and right subtrees.
Hint
In NLR, the node comes first.
Answer
before
- 19In postorder traversal, the node is visited_____both left and right subtrees.
Hint
In LRN, the node comes last.
Answer
after
- 20The recursive implementation of inorder traversal has a base case that checks if root is_____.
Hint
The condition to stop recursion.
Answer
NULL
- 21In level order traversal, after printing a node, its left child (if exists) is pushed into the queue first, followed by its_____child.
Hint
The order of pushing maintains left-to-right order within the level.
Answer
right
- 22In_____
buildFromLevelOrder, after creating the root node from input, we push the root onto a.Hint
This data structure is used to process nodes in FIFO order.
Answer
queue
- 23In_____
buildFromLevelOrder, for each node taken from the queue, we read data for its left child; if the data is not, we create a new left node and push it onto the queue.Hint
This value indicates no child.
Answer
-1
- 24In_____
buildFromLevelOrder, after processing the left child, we read data for thechild.Hint
The next child after left.
Answer
right
- 25In counting leaf nodes, a node is considered a leaf if both its left and right children are_____.
Hint
A leaf has no children.
Answer
NULL
- 26The time complexity for counting leaf nodes in a tree with n nodes is_____.
Hint
It depends on the number of nodes visited.
Answer
O(n)
- 27The iterative implementations of inorder, preorder, and postorder traversal use an explicit_____instead of recursion.
Hint
This data structure follows LIFO order and is commonly used to simulate recursion.
Answer
stack
- 28To implement reverse level order traversal, one common method uses a queue for level order traversal and a_____to reverse the output.
Hint
This data structure reverses order (LIFO).
Answer
stack

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