Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Solve hierarchy
Message
 
To
19/07/1997 20:21:12
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00040763
Message ID:
00040771
Views:
27
>how i can do tree of hierarchy with fox.... i remember in Pascal the Pointers... but in fox....
>
>i saw that you are using trees... can u help me with a sample code....

Are you talking about binary trees for linked lists?

If so you can use Objects to do this:

DEFINE CLASS Node as Custom

*** Data Members
cMyData1=""
dMyTimeStamp={}

*** Or better yet, have the data simply be another object:
oDataMember = .NULL.

*** Node Pointers
oNextItem = .NULL.
oPrevItem = .NULL.

*** Bin Tree uses:
* oLeftLeaf = .NULL.
* oRightLeaf = .NULL.

ENDDEFINE

The top and end of the list would have pointers to .NULL. while all other items in
the middle point at the next and/or previous item. You'll need to add methods to
add and delete items and to walk the tree or list.

It's not terribly efficient in VFP, but if you need to build linked lists or binary
trees you can do it with this type of code.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform