There is a massive amount of computer science literature on the topic of trees and data structures; if you want to read more, Wikipedia provides a great introduction at http://en.wikipedia.org/wiki/Tree_%28data_structure%29.
Note that the use of lambda functions and map is not encouraged as a Python dialect; you can read some (old) opinions on the subject from Guido van Rossum at http://www.artima.com/weblogs/viewpost.jsp?thread=98196. I presented it here because it's a very common dialect with functional and recursive programming. The more common dialect will be based on a list comprehensions.
In any case, the functional dialect based on using map and reduce is the conceptual base for MapReduce frameworks, and you can use ...