Tail recursive treeToList

Avoids calling (++) and should be faster.