• Post Reply Bookmark Topic Watch Topic
  • New Topic

Traverse a tree?  RSS feed

 
Mike Coppola
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone have an example of an algorithm to traverse a tree?
 
Paul Clapham
Sheriff
Posts: 22821
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike, welcome to the Ranch!

There are plenty of tree-traversal algorithms out there. However if you're looking for one which you can apply to your code, it would help if we knew how you implemented your tree. Care to provide some more details?
 
Steve Fahlbusch
Bartender
Posts: 612
7
Mac OS X Python
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure ----



just if you google there are many, many examples out there.
 
Campbell Ritchie
Marshal
Posts: 56529
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you should also find about depth‑first and breadth‑first traversals. They work differently.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!