What is the problem

You want to draw a complete n-ary tree of h levels, but you keep running out of horizontal space for your nodes as you add deeper levels.

Spoiler alert: you avoid this completely by drawing the tree from the ground up.

Strategy

  1. Draw the deepest level’s nodes evenly spaced across your page.
    There will be exactly of them.
  2. Move up one level. Place a parent node centered directly above each group of n nodes.
    (e.g., if n = 2, place one parent node to encompass every pair).
  3. keep doing this going up, until reaching the topmost level, that contains a single node, the root.

Connections