Make a directory tree
Windows Batch File, 429 423 404 bytes

md 1
set C= call:
set/a M=%1-2
%C%f 1 1 2 L
%C%f 1 2 2 M
%C%f 1 3 2 R
goto:eof
:f
md %1\%2
set/a P=%2+1
set/a Q=%2+2
set/a L=%3+1
set D= (%C%t %1\%2\%P% 
if %L%==%M% (if %4==L .&gt;%1\%2\1
if %Q%==%M%%D%1)else (if %P%==%M%%D%2)else (if %2==%M%%D%3)else .&gt;%1\%2\%P%))
if %4==R .&gt;%1\%2\%Q%
)else (if %4==L%C%f %1\%2 1 %L% L
%C%f %1\%2 %P% %L% M
if %4==R%C%f %1\%2 %Q% %L% R)
goto:eof
:t
md %1\%2
.&gt;%1\%2\%2


Call it with the value of n as a command line parameter.

Here is a visualization of the output tree for n=9:

                   1
                +--+--+
                1  2  3
             +--+  |  +--+
             1  2  3  4  5
          +--+  |  |  |  +--+
          1  2  3  4  5  6  7
       +--+  +  |  |  |  |  +--+
       1  2  3  4  5  6  7  8  9
    +--+  |  |  |  |  |  |  |  +--+
    1  2  3  4  5  6  7  8  9 10 11
 +--+  |  |  |  |  |  |  |  |  |  +--+
 1  2  3  4  5  6  7  8  9 10 11 12 13
                |  |  |
                1  2  3
                |  |  |
                1  2  3