Also, note that there is no delete function.
Avltree_test is a program that you will link with your version of avltree.o. Here's an example of how it should work -- commands and output on the left, graphical versions of the trees (just for your own edification, you are not supposed to have your program draw trees) on the right.
UNIX> avltree_test BSTREE> INSERT Moe 0 BSTREE> PREORDER Moe 0.00 |
Regular Insertion![]() |
BSTREE> INSERT Larry 1 BSTREE> PREORDER Moe 0.00 Larry 1.00 |
Regular Insertion![]() |
BSTREE> INSERT Curly 2 BSTREE> PREORDER Larry 1.00 Curly 2.00 Moe 0.00 |
Imbalance at "Moe" - Single Rotation of "Larry"![]() |
BSTREE> INSERT Nick 3
BSTREE> PREORDER
Larry 1.00
Curly 2.00
Moe 0.00
Nick 3.00
|
Regular Insertion![]() |
BSTREE> INSERT Nathan 4
BSTREE> PREORDER
Larry 1.00
Curly 2.00
Nathan 4.00
Moe 0.00
Nick 3.00
|
Imbalance at "Moe" - Double Rotation of "Nathan"![]() |
BSTREE> INSERT Loren 5
BSTREE> PREORDER
Moe 0.00
Larry 1.00
Curly 2.00
Loren 5.00
Nathan 4.00
Nick 3.00
BSTREE>
|
Imbalance at "Larry" - Double Rotation of "Moe"![]() |
You can also use the 200-line file testfile.txt to test things -- it inserts 200 sorted lines -- you should end up with a depth 9 tree:
UNIX> avltree_test < testfile.txt | sed 's/BSTREE. //g' 9 UNIX>