Creating Printable Tree Templates for Tracing Algorithms

36 Views Asked by At

I want to do some manual tracing of algorithms involving trees. I'd like to be able to create printable trees with empty nodes, like the one shown below, but to at least a couple more levels of depth. I'd also like to be able to have different numbers of branches - i.e. binary, ternary, quaternary trees etc.

Can anyone recommend a tool or tool/syntax combination for getting this done with the least cognitive overhead please?

enter image description here

1

There are 1 best solutions below

0
ravenspoint On BEST ANSWER

To produce

enter image description here

First create the g.dot file

graph {
a [label="root"]
b [label=""]
c [label=""]
d [label=""]
ba [label=""]
ca [label=""]
da [label=""]
bc [label=""]
cc [label=""]
dc [label=""]
bd [label=""]
cd [label=""]
dd [label=""]
a -- { b c d }
b -- { ba ca da }
c -- { bc cc dc }
d -- { bd cd dd }
}

Then run the graphviz dot program

dot -Tpng -o sample.png g.dot