Quiz Entry - updated: 2026.09.29
What do ancestor, descendant, sibling and subtree mean in a tree?
Ancestors are a node's parent, grandparent and so on up to the root; descendants are its children, grandchildren and so on; siblings share the same parent; a subtree is a node together with all of its descendants.
Take the tree where A has children B, C, D; B has children E, F; and F has children I, J, K.
- Ancestors of F: B and A. Going up from any node always ends at the root, so the root is an ancestor of every other node.
- Descendants of B: E, F, I, J, K.
- Siblings: B, C and D are siblings (children of A); so are I, J and K.
- Subtree rooted at C: C together with everything below it (G and H). It is itself a valid tree, with C as its root.
The subtree idea is what makes trees so suited to recursion. Every node is the root of its own subtree, and a subtree has the same structure as the whole tree. So an algorithm that works on "a tree" can call itself on each child's subtree and combine the results, which is exactly how depth, height and all the traversals are defined.