I've seen a lot of tutorials about creating binary trees, but nothing about general data trees (where the number of branches is not limited), could someone explain one or post a link?
Thanks a lot!
I've seen a lot of tutorials about creating binary trees, but nothing about general data trees (where the number of branches is not limited), could someone explain one or post a link?
Thanks a lot!
very simple actually.... In a binary tree you have two pointers that could be filled with a branch. In an n-tree you just need a list of branches at each node. linked list or vector should suit you just fine.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
So a data tree is a linked list of pointers to nodes, and each node is a linked list to other nodes, etc?
Also, what are some accepted methods for traversing a data tree? I assume it can only be done in one direction. Iterators?
depends on what it's used for I suppose. Octal tree for instance (8 children per node) is used for color palette optimization and each index represents a specific value for a piece of the RGB value. "traversal" is how you feel like defining it for your given algorithm. Of course you can restrict it to one direction but that depends on what you're doing.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
There a many different algorithms on general trees: B+, B*, AVL, trie, red black, etc. A good Data Structures text would explain about each of these.
Mr. C: Author and Instructor