Home » U++ Library support » U++ Core » NEW: Tree<T> container
Re: NEW: Tree<T> container [message #27732 is a reply to message #27722] |
Fri, 30 July 2010 16:59   |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
i'looked inside your code and borrowed the GetRoot idea 
i personally prefer the Node storage beeing pure Array, without the way complicated next/prev stuff of linked lists. if i really need to iterate through them, i could GetParent and access all children (todo: know one's own position 
now there is 2 flavors of the hole thing.
Tree<T>, beeing organized through a Node<T> as root (where T can easyly be One<T> if needed). making direct deriving of the object unneeded, but still possible if one wants to one can setup own Node with the needed elements directly stored.
Branch<T>, beeing organized directly from a root instance of Branch<T>. having a T instance inside. but this reduces the flexibility a bit (in terms of pick_ Add()'s to the Array, compared to Tree<T>, where T *are* the elements of Tree, here, the Branch only has a T memeber. so Branch is actually a subset of Tree and could be esiely done with Tree<T>. i'll provide another example soon.
thanks for help. if that all works, the algorithms are to be implemented, binary, binary balanced, ...
-
Attachment: TreeTest.rar
(Size: 2.59KB, Downloaded 203 times)
|
|
|
Goto Forum:
Current Time: Tue Aug 26 19:27:16 CEST 2025
Total time taken to generate the page: 0.05580 seconds
|