Nanyang Zhan wrote:
> from root to it's branch, 
> then to the ends of the branch,
> then go back for other branches...

This is a Depth First Search (DFS) tree traversal:

  http://en.wikipedia.org/wiki/Depth-first_search

-- 
Posted via http://www.ruby-forum.com/.