|
-
September 14th, 2005, 05:06 AM
#1
Tree data structure
Hi,
I want to have something like a tree datastructure. I want to represent a tree containing integers.
I want it to be able to easily add nodes and to easily geth the path from a leaf to the base node.
e.g.
Code:
0
1 8 6 3
7 9 4
2
5
//so it must be easy to append an new integer node on any leaf. e.g. append 10 on 5.
//and it must be easy to give the path for a given node. e.g. for 5: 5-2-7-8-0; e.g. for 9: 9-8-0
I can't seem to find anything on msdn. Doesn't this exist? If so, where must I look. If not, how do I start on this?
You may also point me to sample implementations of this..
greets
Last edited by timv; September 14th, 2005 at 05:23 AM.
-
September 14th, 2005, 05:34 AM
#2
Re: Tree data structure
Call in the loop CTreeCtrl::GetParentItem followed by CTreeCtrl::GetItemText and build "the full path".
Yoou migjt also want to use ItemData rather than Item Text (don't forget to set the Item Data in this case and use CTreeCtrl::GetItemData instead of CTreeCtrl::GetItemText)
-
September 14th, 2005, 06:40 AM
#3
Re: Tree data structure
 Originally Posted by VictorN
Call in the loop CTreeCtrl::GetParentItem followed by CTreeCtrl::GetItemText and build "the full path".
Yoou migjt also want to use ItemData rather than Item Text (don't forget to set the Item Data in this case and use CTreeCtrl::GetItemData instead of CTreeCtrl::GetItemText)
I think the question was not about CTreeCtrl, but about a generic tree data structure. Perhaps the thread should be moved to the "Non-Visual C++" forum.
-
September 14th, 2005, 06:43 AM
#4
Re: Tree data structure
What you mean by "tree data structure"? You don't seem like talking about MFC Tree Control or are you?
-
September 14th, 2005, 06:46 AM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|