Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binary tree very slow!
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00057594
Message ID:
00057973
Views:
30
>Note that in the above Pascal code the line
>
>IF ROOT NIL
>
>should be read as "If ROOT does not equal NIL"
>
>I forgot about how the inequality symbol would be interpreted. Duh, I should have used #.
>
>Sorry,
>
>g

I would like to thank you guys for trying to help me. I finally bought the JOE CELKO's book SQL FOR SMARTIES recommanded by Micheal and it showed exactly what I needed to implement. I'm very happy with the performance achieved with this kind of implementation. To be honest, I would never have thought about something like that. Just for your curiosity, representation looks like

A(1,14)
|
------------------
| |
B(2,7) C(8,13)
| |
---------- ----------
| | | |
D(3,4) E (5,6) F(9,10) G(11,12)


where the first number in parenthesis represents left child and the second one the right child. You can extract each subtree easy by doing a query to get only nodes that are in between the left and the right numbers of a node.
There's some manipulations to do when comes the time to insert a node but it's not so complicated.

Thanks again It helped me a lot!
François Guay
EMail: fraguay@videotron.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform