Most recent edit on 2007-01-05 00:35:23 by KogAdmin
Additions:
You may note that the tree node doesn't store its parent, and that I chose to define this recursively.
Deletions:
NEEDS DATA RECOVERY
Edited on 2006-08-17 20:33:01 by KogAdmin
Additions:
NEEDS DATA RECOVERY
Edited on 2006-04-02 17:13:27 by KogAdmin [5 lib up]
Additions:
~- PHP5 lib (PHP Source)∞
Deletions:
~- PHP5 lib [Unavailable at present]
Edited on 2006-04-02 15:54:01 by KogAdmin [link correction]
Additions:
~- PHP4 lib (PHP Source)∞
Deletions:
~- PHP4 lib (tar/gz)∞ [Will upload soon, after cleaning]
Oldest known version of this page was edited on 2006-02-17 01:34:48 by KogAdmin [draft]
Page view:
PHP4 Compatible Object Oriented Binary Tree (Naive)
What am I?
A binary tree with a simple set of operations and a test script. The set of operations is the most basic you need - with some mild duplication (deleteNode). This tree uses recursion, so it may not be that great on large trees. Delete is simple (naive) - it deletes all children recursively, then the node in question. This could probably be cleaner with some quick mods to the source.
Huh? Why
To keep myself from getting rusty, to use recursion (yeah... not that common in what I get paid to do recently) and because startlingly enough there doesn't seem to be one. Go no. Of course, you can always write one using arrays, or associative arrays (or, hashtables as some like to refer to them).
- PHP4 lib (tar/gz)∞ [Will upload soon, after cleaning]
- PHP5 lib [Unavailable at present]
Notes
There are a couple functions that should be private, but there is no protection in PHP4 for such matters. I also made a BTreeNode so you could subclass it.
This page is
CategoryMiscProjects