Trying to solve the same problem using tree rather than HashMap.

Seems to work, just need to figure out how to walk the tree now
to print it in order.
Finished implementing tree. Now must add proper comments.