Tree questions in a Data Structures course follow a small number of patterns: define and differentiate (tree, binary tree, full/complete/perfect), traverse a given diagram (preorder, inorder, postorder), rebuild a tree from two traversals, write an algorithm (recursive or iterative, often as pseudocode), trace a recursive function, and analyse complexity. This guide covers each pattern with model answers you can write in an exam script, then gives a full question bank for written, lab and viva exams.
Tree & Graph series, step 5 of 8. Concepts are taught in Trees, Binary Trees & Traversals; this article is the exam-practice companion. Next: BST Questions for University Exams.
The Exam Tree Used Throughout
Part 1: Definitions and Terminology
Q1. Define a tree with an example
Model answer. A tree is a finite set of one or more nodes such that:
- There is one specially designated node called the root.
- The remaining nodes are partitioned into disjoint sets . Each of these is itself a tree, called a subtree of the root.
Equivalently, a tree is a connected graph with no cycles. A tree with nodes has edges.
Example: the exam tree above, with root A and subtrees rooted at B and C. A real-world example is a folder hierarchy.
Binary tree terminology (with the exam tree)
| Term | Definition | From the exam tree |
|---|---|---|
| Root | Node with no parent | A |
| Leaf / terminal node | Node with no children | E, G, H, I |
| Internal / non-terminal node | Node with at least one child | A, B, C, D, F |
| Parent, child | Direct predecessor, direct successor | F is the parent of H and I |
| Siblings | Children of the same parent | H and I; B and C |
| Ancestors of a node | All nodes on the path from the root to it | Ancestors of H: A, C, F |
| Descendants | All nodes in its subtree except itself | Descendants of B: D, E, G |
| Degree of a node | Number of children | deg(A) = 2, deg(C) = 1, deg(E) = 0 |
| Depth / level of a node | Edges from the root | depth(G) = 3 |
| Height of the tree | Longest root-to-leaf path in edges | 3 (A–B–D–G or A–C–F–H) |
| Path length | Number of edges in the path | A to I: 3 |
Q2. Differentiate full, complete and perfect binary trees
| Feature | Full (strict) | Complete | Perfect |
|---|---|---|---|
| Rule | Every node has 0 or 2 children | All levels full except possibly the last; last level filled left to right | All internal nodes have 2 children and all leaves at the same level |
| Can a node have 1 child? | No | Yes (at most one such node, on the second-last level) | No |
| Nodes for height | between and | between and | exactly |
| Relationship | — | — | Every perfect tree is both full and complete |
Applying this to the exam tree:
- Full? No. C and D have one child each.
- Complete? No. D has no left child, while nodes exist further right on the next level.
- Perfect? No.
Some older textbooks use “full binary tree” to mean what this table calls perfect. If your course textbook does, follow it, and mention the alternative name in one line.
Properties of binary trees
With levels numbered from 0 at the root and height in edges:
- The maximum number of nodes on level is .
- The maximum number of nodes in a binary tree of height is .
- For any non-empty binary tree, , where = number of leaves and = number of nodes with two children.
- Check on the exam tree: leaves E, G, H, I give .
- Nodes with two children A, B, F give . ✓
- A binary tree with nodes has exactly edges and null links.
- The minimum height of a binary tree with nodes is .
Proof of property 3 (a common 4–5 mark question).
- Let be the number of nodes with one child. Total nodes: .
- Every node except the root has exactly one incoming edge, so edges .
- Counting edges from the parent side, edges .
- Therefore , which gives . ∎
Binary tree representations
1. Linked representation. Each node has three fields: LEFT, INFO, RIGHT.
struct Node {
char data;
Node* left;
Node* right;
explicit Node(char value) : data(value), left(nullptr), right(nullptr) {}
};
2. Sequential (array) representation. Store the root at index 1. For a node at index :
- left child at
- right child at
- parent at
(With 0-based indexing: , and .)
The exam tree in a 1-based array:
| Index | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | A | B | C | D | E | F | – | – | G | – | – | H | I |
- G is the right child of D (index 4), so it sits at .
- H and I are the children of F (index 6), so they sit at 12 and 13.
- Thirteen slots hold nine nodes. For a skewed tree the waste grows exponentially, which is the main disadvantage of the array method.
- A complete tree has no gaps at all, which is why heaps use this method.
| Linked | Array | |
|---|---|---|
| Memory | Two pointers per node | Can waste many empty slots |
| Insert / delete | Easy | Hard (may need resizing) |
| Find parent | Needs an extra pointer | , |
| Best for | General trees | Complete trees, heaps |
Part 2: Traversal Questions
Q3. Write the preorder, inorder and postorder of the given tree
Method that never fails in an exam: write the rule at the top of your answer, then expand one subtree at a time.
Preorder (Root, Left, Right): A, then preorder(B) = B D G E, then preorder(C) = C F H I. → A B D G E C F H I
Inorder (Left, Root, Right): inorder(B) = D G B E, then A, then inorder(C) = H F I C. → D G B E A H F I C
Postorder (Left, Right, Root): postorder(B) = G D E B, then postorder(C) = H I F C, then A. → G D E B H I F C A
Level order: A B C D E F G H I
Quick self-checks:
- Preorder starts with the root.
- Postorder ends with the root.
- In inorder, every left-subtree node comes before A, and every right-subtree node comes after it.
- Output
Expression trees (a favourite 3–5 mark question)
Operators are internal nodes, operands are leaves.
- Preorder gives prefix (Polish) notation:
* + a b - c d - Inorder gives infix (without brackets):
a + b * c - d, so you must add brackets for each subtree to keep the meaning:(a + b) * (c - d) - Postorder gives postfix (reverse Polish) notation:
a b + c d - *
To evaluate postfix, use a stack:
- Push each operand.
- On an operator, pop two operands, apply the operator, and push the result.
Part 3: Construct a Binary Tree From Traversals
Rule to remember:
- Preorder or postorder tells you which node is the root.
- Inorder tells you which nodes are on its left and right.
- So you need inorder plus one of the other two (with distinct values). Preorder + postorder alone is not enough in general.
Q4. Construct the binary tree whose preorder is A B D E C F G and inorder is D B E A F C G.
- First preorder element A is the root. In inorder,
D B Elie left of A andF C Gright of A. - Left subtree: its preorder is the next three preorder elements,
B D E; its inorder isD B E. Root B; leftD, rightE. - Right subtree: preorder
C F G, inorderF C G. Root C; leftF, rightG. - Verify: the inorder of your drawn tree must reproduce the given inorder.
D B E A F C G✓.
Q5. Construct the tree from postorder D E B F G C A and inorder D B E A F C G.
- The last postorder element is the root (A).
- Split inorder at A, as before.
- Process postorder from the right: the element before A (C) is the root of the right subtree, so build the right subtree first.
- The result is the same tree as Q4, which shows that both methods agree.
Q6. Construct the tree from preorder A B D G E C F H I and inorder D G B E A H F I C.
Answer: the exam tree at the top of this page.
Part 4: Algorithm Writing (Recursive, Iterative, Pseudocode)
Recursive traversal algorithms
PREORDER(T)
1. If T = NULL, return.
2. Visit INFO[T].
3. PREORDER(LEFT[T]).
4. PREORDER(RIGHT[T]).
INORDER(T)
1. If T = NULL, return.
2. INORDER(LEFT[T]).
3. Visit INFO[T].
4. INORDER(RIGHT[T]).
POSTORDER(T)
1. If T = NULL, return.
2. POSTORDER(LEFT[T]).
3. POSTORDER(RIGHT[T]).
4. Visit INFO[T].
Base case: an empty subtree (step 1). Recursive case: steps 2–4, with two recursive calls, each on a strictly smaller subtree, so the recursion always terminates.
Iterative (non-recursive) traversal algorithms using a stack
These are classic 5–8 mark questions: “Write a non-recursive algorithm for inorder traversal.”
ITERATIVE-PREORDER(ROOT)
1. If ROOT = NULL, return.
2. PUSH(ROOT).
3. While stack is not empty:
PTR := POP()
Visit INFO[PTR]
If RIGHT[PTR] ≠ NULL, PUSH(RIGHT[PTR]) // right first,
If LEFT[PTR] ≠ NULL, PUSH(LEFT[PTR]) // so left is popped first
ITERATIVE-INORDER(ROOT)
1. PTR := ROOT.
2. Repeat while PTR ≠ NULL or stack is not empty:
While PTR ≠ NULL: // go as far left as possible
PUSH(PTR); PTR := LEFT[PTR]
PTR := POP()
Visit INFO[PTR]
PTR := RIGHT[PTR]
ITERATIVE-POSTORDER(ROOT) // two-stack method
1. If ROOT = NULL, return.
2. PUSH ROOT onto S1.
3. While S1 is not empty:
PTR := POP(S1); PUSH PTR onto S2
If LEFT[PTR] ≠ NULL, PUSH LEFT[PTR] onto S1
If RIGHT[PTR] ≠ NULL, PUSH RIGHT[PTR] onto S1
4. Pop and visit every node of S2.
Why does the two-stack postorder work? S1 produces the order Root, Right, Left; pushing that onto S2 and popping reverses it to Left, Right, Root.
Height, number of nodes, leaves and internal nodes
HEIGHT(T) // edges; empty tree = -1
1. If T = NULL, return -1.
2. Return 1 + MAX(HEIGHT(LEFT[T]), HEIGHT(RIGHT[T])).
COUNT(T)
1. If T = NULL, return 0.
2. Return 1 + COUNT(LEFT[T]) + COUNT(RIGHT[T]).
LEAVES(T)
1. If T = NULL, return 0.
2. If LEFT[T] = NULL and RIGHT[T] = NULL, return 1.
3. Return LEAVES(LEFT[T]) + LEAVES(RIGHT[T]).
INTERNAL(T) = COUNT(T) - LEAVES(T)
Complete C++ program (lab exam ready)
This program builds the exam tree and prints everything asked in this section, using both recursive and iterative traversals.
#include <iostream>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
struct Node {
char data;
Node* left;
Node* right;
explicit Node(char value) : data(value), left(nullptr), right(nullptr) {}
};
void preorder(Node* t) {
if (!t) {
return;
}
cout << t->data << ' ';
preorder(t->left);
preorder(t->right);
}
void inorder(Node* t) {
if (!t) {
return;
}
inorder(t->left);
cout << t->data << ' ';
inorder(t->right);
}
void postorder(Node* t) {
if (!t) {
return;
}
postorder(t->left);
postorder(t->right);
cout << t->data << ' ';
}
void preorderIterative(Node* root) {
if (!root) {
return;
}
stack<Node*> st;
st.push(root);
while (!st.empty()) {
Node* p = st.top();
st.pop();
cout << p->data << ' ';
if (p->right) {
st.push(p->right); // right first so left is processed first
}
if (p->left) {
st.push(p->left);
}
}
}
void inorderIterative(Node* root) {
stack<Node*> st;
Node* p = root;
while (p || !st.empty()) {
while (p) { // go as far left as possible
st.push(p);
p = p->left;
}
p = st.top();
st.pop();
cout << p->data << ' ';
p = p->right;
}
}
void postorderIterative(Node* root) {
if (!root) {
return;
}
stack<Node*> s1, s2;
s1.push(root);
while (!s1.empty()) {
Node* p = s1.top();
s1.pop();
s2.push(p); // s2 receives Root, Right, Left order
if (p->left) {
s1.push(p->left);
}
if (p->right) {
s1.push(p->right);
}
}
while (!s2.empty()) { // reversed: Left, Right, Root
cout << s2.top()->data << ' ';
s2.pop();
}
}
void levelOrder(Node* root) {
if (!root) {
return;
}
queue<Node*> q;
q.push(root);
while (!q.empty()) {
Node* p = q.front();
q.pop();
cout << p->data << ' ';
if (p->left) {
q.push(p->left);
}
if (p->right) {
q.push(p->right);
}
}
}
int height(Node* t) {
return t ? 1 + max(height(t->left), height(t->right)) : -1;
}
int countNodes(Node* t) {
return t ? 1 + countNodes(t->left) + countNodes(t->right) : 0;
}
int countLeaves(Node* t) {
if (!t) {
return 0;
}
if (!t->left && !t->right) {
return 1;
}
return countLeaves(t->left) + countLeaves(t->right);
}
void destroy(Node* t) {
if (!t) {
return;
}
destroy(t->left);
destroy(t->right);
delete t;
}
int main() {
// Build the exam tree: connect each node to its parent.
Node* A = new Node('A');
A->left = new Node('B');
A->right = new Node('C');
A->left->left = new Node('D');
A->left->right = new Node('E');
A->left->left->right = new Node('G');
A->right->left = new Node('F');
A->right->left->left = new Node('H');
A->right->left->right = new Node('I');
cout << "Preorder (recursive): ";
preorder(A);
cout << '\n';
cout << "Preorder (iterative): ";
preorderIterative(A);
cout << '\n';
cout << "Inorder (recursive): ";
inorder(A);
cout << '\n';
cout << "Inorder (iterative): ";
inorderIterative(A);
cout << '\n';
cout << "Postorder (recursive): ";
postorder(A);
cout << '\n';
cout << "Postorder (iterative): ";
postorderIterative(A);
cout << '\n';
cout << "Level order: ";
levelOrder(A);
cout << '\n';
int n = countNodes(A), leaves = countLeaves(A);
cout << "Height = " << height(A) << ", nodes = " << n
<< ", leaves = " << leaves << ", internal = " << n - leaves << '\n';
destroy(A);
}
Output:
Preorder (recursive): A B D G E C F H I
Preorder (iterative): A B D G E C F H I
Inorder (recursive): D G B E A H F I C
Inorder (iterative): D G B E A H F I C
Postorder (recursive): G D E B H I F C A
Postorder (iterative): G D E B H I F C A
Level order: A B C D E F G H I
Height = 3, nodes = 9, leaves = 4, internal = 5
Part 5: Tracing Recursive Functions
Q7. Show the sequence of calls made by inorder(1) on the tree 1(2(4, 5), 3) and give the output.
| # | Call / action | Call stack after (bottom → top) | Output so far |
|---|---|---|---|
| 1 | inorder(1) → goes left | 1 | |
| 2 | inorder(2) → goes left | 1, 2 | |
| 3 | inorder(4); left is NULL; print 4; right is NULL; return | 1, 2 | 4 |
| 4 | back in 2: print 2; go right | 1, 2 | 4 2 |
| 5 | inorder(5): print 5; return | 1, 2 | 4 2 5 |
| 6 | 2 returns; back in 1: print 1; go right | 1 | 4 2 5 1 |
| 7 | inorder(3): print 3; return | 1 | 4 2 5 1 3 |
| 8 | 1 returns | (empty) | 4 2 5 1 3 |
- The maximum stack depth is 3 (calls for 1, 2 and then 4 or 5), plus the NULL calls, which return immediately.
- This is why the space complexity is .
Q8. What does fun(root) print for the exam tree? What does mystery(root) return?
void fun(Node* t) {
if (t == nullptr) {
return;
}
fun(t->right);
cout << t->data << ' ';
fun(t->left);
}
int mystery(Node* t) {
if (t == nullptr) {
return 0;
}
int self = ((t->left == nullptr) != (t->right == nullptr)) ? 1 : 0;
return self + mystery(t->left) + mystery(t->right);
}
Answer.
funis reverse inorder (Right, Root, Left), so it prints the inorder sequence backwards: C I F H A E B G D.mysteryadds 1 for every node where exactly one child is null, so it counts nodes with exactly one child: C and D → 2.
You can verify both with this program:
#include <iostream>
using namespace std;
struct Node {
char data;
Node* left;
Node* right;
explicit Node(char value) : data(value), left(nullptr), right(nullptr) {}
};
void fun(Node* t) {
if (t == nullptr) {
return;
}
fun(t->right);
cout << t->data << ' ';
fun(t->left);
}
int mystery(Node* t) {
if (t == nullptr) {
return 0;
}
int self = ((t->left == nullptr) != (t->right == nullptr)) ? 1 : 0;
return self + mystery(t->left) + mystery(t->right);
}
void destroy(Node* t) {
if (!t) {
return;
}
destroy(t->left);
destroy(t->right);
delete t;
}
int main() {
Node* A = new Node('A');
A->left = new Node('B');
A->right = new Node('C');
A->left->left = new Node('D');
A->left->right = new Node('E');
A->left->left->right = new Node('G');
A->right->left = new Node('F');
A->right->left->left = new Node('H');
A->right->left->right = new Node('I');
fun(A);
cout << "\nmystery = " << mystery(A) << '\n';
destroy(A);
}
Output:
C I F H A E B G D
mystery = 2
Part 6: Complexity Analysis
| Algorithm | Time | Space | Reason |
|---|---|---|---|
| Recursive pre/in/postorder | Each node visited once; stack holds one frame per level | ||
| Iterative pre/in/postorder | ( for two-stack postorder) | Each node pushed and popped once | |
| Level order | Queue holds at most one level (width ) | ||
| Height, count, leaves | One visit per node | ||
| Build from pre + in (linear search) | Searching inorder for each root | ||
| Build from pre + in (hash map) | Index lookup in |
Writing the recurrence (often asked for 2–3 marks). For a traversal on a tree whose left subtree has nodes:
- Recurrence: , with .
- Each node contributes a constant amount of work, so by induction .
- Space is , and the height ranges from (balanced) to (skewed).
- So the space is between and .
Question Bank With Model Answers
All questions are representative exam-style questions (see the note at the top).
Short questions (1–2 marks)
Q9. Define a leaf node. A node with no children (degree 0). Exam tree: E, G, H, I.
Q10. What is the degree of a tree? The maximum degree of any node in it. For a binary tree, at most 2.
Q11. Define the depth of a node. The number of edges on the path from the root to the node.
Q12. What is the maximum number of nodes in a binary tree of height 4 (edges)? .
Q13. How many null pointers does a binary tree with 20 nodes have? .
Q14. A binary tree has 10 leaves. How many nodes have two children? .
Q15. Which traversal of an expression tree gives postfix notation? Postorder.
Q16. Which traversal is used to delete a tree, and why? Postorder, because children must be deleted before their parent.
Q17. What is a skewed binary tree? A tree in which every internal node has only one child (all left, or all right); it behaves like a linked list.
Q18. In 1-based array representation, where is the parent of the node at index 11? .
Q19. Can preorder and postorder together always identify a binary tree? No; only for full binary trees (inorder is needed in general).
Q20. What data structure is used for level-order traversal? A queue.
Medium questions (3–5 marks)
Q21. Differentiate between a complete and a full binary tree with diagrams.
- Use the comparison table from Q2 in Part 1.
- Draw the “full (not complete)” and “complete (not full)” trees from the types diagram.
- State that a perfect tree is both full and complete.
Q22. Write the preorder, inorder and postorder of the exam tree.
- Preorder:
A B D G E C F H I - Inorder:
D G B E A H F I C - Postorder:
G D E B H I F C A
Q23. Prove that .
See the proof under “Properties of binary trees” in Part 1.
Q24. Represent the exam tree using the array method and state one disadvantage.
- Representation: see the array table in Part 1.
- Disadvantage: wasted slots. Here 13 slots hold 9 nodes, and for skewed trees the waste grows exponentially.
Q25. Draw the expression tree for (a + b) * (c - d) and write its prefix and postfix forms.
- Prefix:
* + a b - c d - Postfix:
a b + c d - *
Q26. Write a recursive function to count the leaf nodes of a binary tree and state its complexity.
- Algorithm:
LEAVES(T)in Part 4. - Time: . Space: .
Broad questions (5–10 marks)
Q27. (a) Construct the binary tree from preorder A B D E C F G and inorder D B E A F C G. (b) Write its postorder.
- (a) See Q4 in Part 3.
- (b) Postorder: D E B F G C A.
Q28. Write a non-recursive algorithm for inorder traversal. Trace it on the exam tree, showing the stack after each visit.
Algorithm: ITERATIVE-INORDER in Part 4. Trace (stack shown bottom → top after each visit):
| Visit | Stack after visit |
|---|---|
| D | A, B |
| G | A, B |
| B | A |
| E | A |
| A | (empty) |
| H | C, F |
| F | C |
| I | C |
| C | (empty) |
Output: D G B E A H F I C.
Q29. Explain the linked and sequential representations of a binary tree. Compare them with respect to memory, insertion and parent lookup.
See “Binary tree representations” in Part 1.
Q30. Write recursive algorithms for preorder, inorder and postorder. Derive their time and space complexity.
- Algorithms: Part 4.
- Complexity: Part 6.
Output tracing questions
Q31. Trace inorder(1) on 1(2(4, 5), 3).
4 2 5 1 3 (see the table for Q7 in Part 5).
Q32. What are the outputs of fun and mystery on the exam tree?
funprintsC I F H A E B G D.mysteryreturns2.
Q33. What does this print for the exam tree?
void g(Node* t, int depth) {
if (!t) {
return;
}
if (depth == 2) {
cout << t->data << ' ';
}
g(t->left, depth + 1);
g(t->right, depth + 1);
}
// called as g(root, 0)
It prints the nodes at depth 2 in left-to-right order: D E F.
Diagram-based questions
Q34. From the exam tree diagram, list: (a) siblings of D, (b) ancestors of I, (c) the subtree rooted at C, (d) the height of B.
- (a) E
- (b) A, C, F
- (c) C, F, H, I
- (d) 2 (path B–D–G)
Q35. Draw the binary tree with level-order array (1-based) [1: P, 2: Q, 3: R, 4: –, 5: S, 6: T] and write its inorder.
- P has children Q (index 2) and R (index 3).
- Q has only a right child, S (index 5).
- R has a left child, T (index 6).
- Inorder: Q S P T R
Q36. Is the exam tree height-balanced? Check every node.
- At D: left height −1, right 0 ✓
- At B: left 1 (D–G), right 0 ✓
- At F: left 0, right 0 ✓
- At C: left 1, right −1 → difference 2 ✗
Not balanced (it fails at C).
Algorithm-writing questions
Q37. Write an algorithm to find the height of a binary tree.
See HEIGHT(T) in Part 4.
Q38. Write an algorithm to count internal nodes.
Either compute COUNT(T) − LEAVES(T), or count directly:
INTERNAL(T)
1. If T = NULL, return 0.
2. If LEFT[T] = NULL and RIGHT[T] = NULL, return 0. // a leaf
3. Return 1 + INTERNAL(LEFT[T]) + INTERNAL(RIGHT[T]).
Q39. Write an algorithm for level-order traversal.
Use a queue:
- Enqueue the root.
- While the queue is not empty, dequeue a node and visit it.
- Enqueue its non-null children (left, then right).
See level order.
Viva questions (short oral answers)
Q40. Why is a tree called non-linear? One node can be followed by several nodes; there is no single “next”.
Q41. Difference between a tree and a graph? A tree is a connected graph with no cycles and exactly edges; a graph can have cycles and be disconnected.
Q42. What is the root’s depth? A leaf’s height? Both 0 (edge convention).
Q43. Why do we need the base case if (root == NULL) { return; }? Without it the function dereferences a null pointer and never stops recursing.
Q44. What is the time complexity of any traversal? .
Q45. Which traversal gives sorted output? Inorder, on a binary search tree only.
Q46. What is the space complexity of recursive traversal, and when is it worst? ; worst () for a skewed tree.
Q47. Why use a stack for iterative DFS traversals but a queue for level order? DFS must return to the most recently postponed node (LIFO); level order processes nodes in the order they were discovered (FIFO).
Q48. Can you build a tree from inorder alone? No; many trees share the same inorder.
Q49. What is a complete binary tree used for? Binary heaps (stored in an array without gaps).
Q50. What is a threaded binary tree? A tree whose null right (or left) pointers point to the inorder successor (or predecessor), allowing traversal without a stack.
Q51. What is the difference between a binary tree and a BST? A BST adds the ordering rule left < root < right for whole subtrees. See the BST exam guide.
Q52. What happens in memory when you call new Node('A')? A node is allocated on the heap and its address returned; it must be freed with delete.
Q53. How many different binary trees have 3 nodes (unlabelled)? 5 (the Catalan number ).
Q54. What is a forest? A set of disjoint trees; removing the root of a tree leaves a forest of its subtrees.
Exam-Writing Tips
- Draw first, then answer. Redraw the given tree neatly with left and right children clearly separated; most traversal mistakes come from a messy copy.
- State conventions (height in edges or nodes; level starting at 0 or 1) in one line.
- Show the subtree split when writing a traversal: “A, then preorder(B) = …, then preorder(C) = …” earns method marks even if you slip once.
- Verify reconstructed trees by regenerating the given traversals.
- For algorithms, write the base case first, then the recursive case, then complexity with a one-line reason.
- Lab exams: always initialise
leftandrighttonullptr, test with an empty tree and a one-node tree, and free memory in postorder.
Next Steps
- Next: BST Questions for University Exams in Bangladesh: insertion sequences, deletion traces and BST algorithms.
- Revise the concepts in Trees, Binary Trees & Traversals or practise coding with Tree Interview Questions.
- Graph traversal is usually the next exam chapter: What Are DFS and BFS?