Memory efficient implementation of Scala Tree.