Click to See Complete Forum and Search --> : tree data structure
Is there any source code which implements tree data structure? I mean something like "CTree" as CArray for array or CList for linked list in MFC. I also hope that it is not restricted to binary trees, but able to handle general trees with varying degree (number of child nodes).
muscicapa
May 20th, 1999, 08:37 AM
Try STL
Thanks.
But I couldn't find out in STL any suitable template container class for tree data structure. What do you suggest in STL specifically? In general one can implement tree data structure using linked lists, but I want more direct method.
muscicapa
May 20th, 1999, 10:54 PM
You seem to be right and I am surprised.
I vaguely remember some C header file named btree.h. I am sure someone must have implemented an AVL tree library and made it publicly accessible. If not it would be nice if you worked on it and made it available ..If that is too hard maybe you could use a hidden tree control !
good luck
C. Shawn Bowlin
June 28th, 1999, 04:47 PM
Did you ever come up with anything...
I'm confronted with the same problem had hoped something
was already available...
chris law
June 29th, 1999, 03:55 AM
Lets discuss properties
(I have to implement one anyway...)
I need
- fast child lookup
- fast insertion/deletion of child nodes
- detection of equivalent paths (potential tree)
- different amount of memory in every node
- mark of a main variation
chrislaw
C. Shawn Bowlin
June 29th, 1999, 09:00 AM
Well, my requirements are not very demanding.
I need something to store Registry data. I was
thinking along the lines of something derived from
CTree (if found) that I could tailor to Registry
information (CRegTree). The access methods would
be similar to the API Registry routines (path
oriented).
FYI, this is for a client/server Registry engine.
muscicapa
June 29th, 1999, 11:13 PM
There seems to be some BTree source for C++ on the simtel site
http://oak.oakland.edu/simtel.net
I havent seen the code..
June 30th, 1999, 01:30 AM
I think a linked list is the best implementation for a Tree-structure.
I cannot provide code, but maybe you are interested in a class the extends
the CTreeCtrl to multiple selection of items:
http://www.techsoft.no/bendik/
C. Shawn Bowlin
June 30th, 1999, 06:43 AM
BTree's are great for sorted data...
(Binary Tree, each node has two branches, etc)
But that's not what I'm looking for.
Plus...I just got moved to another project,
but I will still be glad to help anyway I can.
muscicapa
June 30th, 1999, 09:38 AM
A BTree is not merely a binary tree but also sorts data and uses the AVL algorithm for optimized height balancing for quick retrieval.
Check Knuth, but he probably uses the term AVL trees. A mere binary tree is quite trivial anyway.
Jerry Coffin
June 30th, 1999, 05:38 PM
The map and multimap classes in STL are typically implemented as red/black trees. Depending on what you're tyring to accomplish, this may or may not be useful.
I've also written a binary tree class that's somewhat similar, though it makes no attempt at balancing itself, so if it gets out of balance, the performace can suck.
Depending on exactly what you're trying to accomplish, it may also be extremely trivial to implement your own -- it sounds like you want direct control over the tree's structure rather than having it attempt to keep itself balanced (which doesn't normally apply to multiway trees) which tends to be the easiest thing to implement.
The universe is a figment of its own imagination.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.