Search code examples
graphicstreerenderingcomputer-sciencecomputational-geometry

How many leaves has a quadtree?


Let N be the number of inner nodes in a quadtree. Why is the number of leaves equal to 1 + 3 * N? I don't understand how we need to argue.


Solution

  • Consider expanding a quadtree by subdividing a leaf node. That leaf node becomes an internal node (decreasing the leaf count by one), and four leaf nodes are added. If the previous number of internal nodes was N, the new number of internal nodes is N+1, and the number of leaves is 1 + 3*N - 1 + 4 = 1 + 3*(N+1). The general statement follows by induction.