Greetings,
I've been working for a while on a pretty simple B-Tree implementation
in Java...but my life just went crazy and I need a little help. I'm
certainly not asking for source code that I can just pop in and have
it work magically. All I need is some nicely written, Java/Object
Oriented pseudocode. So, I'd really appreciate a hand. I promise to
tip honorably according to how much I've been helped. :) If you feel
I'm not offering enough, just tell me, I'm new to this kind of thing.
It's OK if you copy + paste from another site as long as I have the
reference.
Here's the requirements:
It's written in java. One can use any class from the API they need to
(I know there's some TreeMaps and whatnot in the API). The B-tree is a
standard M-ary tree of size M=5 with these properties (taken from a
textbook):
1. Data can be stored at any level (not just the leaves). They data is
the same as the keyvalue - an int between 1 an 99 (including them).
2. The nonleaf nodes store as many as M-1 keys to guide the searching;
key i represents the smallest key in subtree i+1.
3. The root is either a leaf or has between 2 and M children.
4. All nonleaf nodes (Except the root) have between at most M/2 and M children.
The data we input will be no more than enough to make 3 levels of the tree.
Now, here's what the program needs to be able to do:
A. Draw the tree, vertically (as in, root node grows down from the
center top of the screen). Just using ASCII text (I code on a Linux
text console).
B. Delete a node at a given integer.
C. Insert a given integer into the tree.
D. Locate a given int and indicate a success/fail message
E. Find the depth of any data item or report failure.
That's it! Nothing really complex or fancy -- just your average B-tree.
I need this no later than the afternoon of Thursday (the 21st). Of
course, I'll tip more if I get something earlier :P
I greatly, sincerely appreciate your help. |