Recall & Review
beginner
What does it mean to mirror a binary tree?
Mirroring a binary tree means swapping the left and right children of every node in the tree, creating a mirror image of the original tree.
Click to reveal answer
intermediate
Which traversal method is commonly used to mirror a binary tree?
A post-order traversal is commonly used because it processes children before the parent, allowing safe swapping of left and right subtrees.
Click to reveal answer
beginner
Show the base case condition in a recursive function to mirror a binary tree.
The base case is when the current node is null (empty), then return immediately because there is nothing to mirror.
Click to reveal answer
beginner
What happens to the left and right children of a node during mirroring?
The left and right children are swapped. The left child becomes the right child and the right child becomes the left child.
Click to reveal answer
intermediate
Why is it important to recursively mirror the subtrees before swapping the children?
Recursively mirroring subtrees first ensures that the entire subtree is mirrored before swapping, preserving the correct mirror structure.
Click to reveal answer
What is the first step in mirroring a binary tree recursively?
✗ Incorrect
The first step is to check if the current node is null to stop recursion if there is no node.
After mirroring the left and right subtrees, what do you do next?
✗ Incorrect
After mirroring the subtrees, swap the left and right children to complete the mirror at the current node.
Which traversal order is best suited for mirroring a binary tree?
✗ Incorrect
Post-order traversal is best because it processes children before the parent, allowing safe swapping.
What will be the mirror of a tree with only one node?
✗ Incorrect
A single-node tree mirrored is the same tree because there are no children to swap.
If a node has left child 2 and right child 3, what will be after mirroring?
✗ Incorrect
Mirroring swaps children, so left becomes 3 and right becomes 2.
Explain step-by-step how to mirror a binary tree using recursion.
Think about what happens at each node and how recursion helps.
You got /4 concepts.
Describe the changes in the tree structure after mirroring a binary tree.
Imagine flipping the tree like a reflection in a mirror.
You got /3 concepts.