You can represent any hierarchy with a binary tree. You just have to consider that all children of a node cumulatively is the number n instead of 2, although each node has exactly 2 children nodes.
If you go with the binary tree, consider an AVL tree, which is perfectly balanced at all times. You may be also interested in the B tree, which grows up instead of down and has as many node divisions as you want, although there is still a defined limit on the number of nodes in a branch - there has to be in order to define a new root. But I think the real thing you're looking for here is something akin to a linked list. If you consider that a node could four pointers: Up Down Left Right Up goes to the parent node Down goes to the first child node Left goes to the previous sibling Right goes to the next sibling You ought to be able to represent a node with n children nodes, nested infinitely deep. A language that uses pointers or allows for infinite (or near infinite) growth of an array (like C++ or CF) should be able to provide you what you need. I think that XML is a structure like what you're talking about. - Matt Small Jeff Chastain wrote: > > I am trying to remember my old CS days, but the memory is going. I need to > simulate a tree with n-nodes per branch ... i.e. a nested folder structure > with 0 to n objects in each folder. The folders can be nested infinitely > deep. So, what is the algorithm for traversing this type of tree? > > Most everything I have found thus far is for building binary trees ... i.e. > a given node only has two children. I need n children per node. One > article said that any type of tree can be represented as a binary tree, but > I am failing to see that. > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:194721 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

