From: Nanyang Zhan Date: 2007-04-21T07:29:04+09:00 Subject: Re: looping through a tree from trunk to leaves Rich Morin wrote: > The word "loop" may be leading you in the wrong direction. If > you hear the words "tree" or "hierarchy", you should be looking > at recursive solutions. Now it seems obviously "loop" IS a wrong word. Both "walk" and "travel" are far more fit the idea. I'll start form a very simple tree, no cross. and your code certainly give my a idea to start. thanks. Suraj Kurapati wrote: > This is a Depth First Search (DFS) tree traversal: > > http://en.wikipedia.org/wiki/Depth-first_search And thank you, Suraj Kurapati. The link and the terms no only help solve my problem, but also open a world of search relate algorithm to me. -- Posted via http://www.ruby-forum.com/.