Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binary tree very slow!
Message
From
31/10/1997 09:55:00
 
 
To
31/10/1997 09:44:32
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00057594
Message ID:
00057596
Views:
29
>Hi
>
>I have implemented a binary tree in a table using at least the following three fields: id, left and right where id is the node identification and left and right are children of the node. Each child can point to another node id of the same table using its identification number. I used 0 when there is no child.
>
>I Created a class to iterate on that three using postfix search but it is not very performant. For a tree that has only 64 nodes, it takes about 5 seconds to do only a postfix search for each node without doing any piece of code during the search. A GOTO statement is used each time a child must be visited resulting of a lots of disk access. I know that the search time must increase as the tree growth but I can't live with a very poor performance like that.
>
>Is there a way to improve performance significantly using my tree implementation ?
>
>Is there any other way faster to implement a tree in a data base environment ?
>
>thanks in advance

I have had better success modeling trees using a parent pointer within the child instead of pointers within the children.

If you want a pure SQL approach check out Joe Celco's 'SQL for Smarties' book.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform