|
-
May 29th, 2002, 12:31 PM
#1
TreeView Search
Is there a smart way to search the TreeView control?
thank you.
-
May 30th, 2002, 10:34 AM
#2
Re: TreeView Search
Originally posted by AlexKrat
Is there a smart way to search the TreeView control?
thank you.
That depends. If you are looking for somehting you know will almost always close to the root, say 1 or 2 steps away then a Breadth first search is appropriate. On the other hand, if you think that it will often be a leaf then you migth want to try a Depth First Search
Jared
-
May 30th, 2002, 01:37 PM
#3
In both cases search time is exponential. ( I don't realy know there it is in the tree).
I thought about a hashtable that holds all tree elements but wasn't sure if it worth the maintance.
thank you for your help!
-
May 31st, 2002, 08:04 AM
#4
Originally posted by AlexKrat
In both cases search time is exponential. ( I don't realy know there it is in the tree).
I thought about a hashtable that holds all tree elements but wasn't sure if it worth the maintance.
thank you for your help!
Hashtables are great for things like that. Also it's relatively easy to maintain. Just create functions for adding and deleting from the tree and make sure they update the Hashtable.
Jared
-
June 3rd, 2002, 10:10 AM
#5
I guess if we remove a branch we are back to the same problem.
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
|