Model answer
Induct on n. A one-node tree has zero edges; adding a new node while preserving a tree requires exactly one edge to an existing node, so an n-node tree has (n−2)+1=n−1 edges.
Use the key terms, then explain the reasoning.
Trees model hierarchical relationships with nodes, edges, a root, parent-child links, depth, height, and subtrees.
Open this in the visual labA tree is a connected acyclic hierarchy. The unique path between any two nodes makes recursive parent-child decomposition possible, while choosing a root gives depth, ancestor, descendant, and subtree relationships.
Binary trees limit each node to left and right children. Shape terms are distinct: full concerns child count, complete concerns level filling, perfect fills every level, and balanced bounds height relative to node count.
This is primarily a conceptual or selection topic. Use the linked implementation topics in this section to see the invariant expressed in C++.
Open a prompt when you are ready to check your answer.