CSCI 260 Fall 2026: Lab: Binary Search Trees: AVL
This is a two-part lab for which there
are deliverables in each of the two weeks.
Part I DUE one week after the lab is presented in the lab, for demonstration and git-submit. The instructor
will test and provide limited feedback on correctness.
Part II is DUE two weeks after the lab is presented in the lab, for submission via git.
In this lab, you are to alter an implementaton of the Dictionary ADT that
-
it
works (as a Binary Search Tree) and
- so that it balances as per AVL Tree operations
-- i.e., a BST that balances by rotations to keep it in
AVL-tree "balance" (no node has children whose height differs by more than
one).
Adapt the
C++ files, header, and makefile files provided.
Part I is a Lab Demo of Working Subset I, to be demonstrated in the lab one week after the lab is introduced.
Submit the files via git.
Working Subset 1
- The BST is to have the "Find" option enabled within testapp.cpp.
- The fields BF and height are to be correctly maintained.
- The balance is to be maintained, and RightRotate and
LeftRotate are working properly.
Part II is DUE two weeks after the lab is introduced (see week-by-week
schedule for exact date):
-
A working AVL tree, with RightRotate and LeftRotate
and both double rotations as part of the menu.
All options (find, remove (extract), insert,
debugprint) are to be working options from the testapp menu.
Insert and Remove are now requried to use rotations to maintain balance,
as per AVL tree algorithms.
-
To submit the files, use "git" to submit all the .cpp files and the makefile, and the header files.
The project produces a link-based Binary Search Tree.
A BST is ordered so that for any node in the tree, all the nodes in
its left subtree have key value less than or equal to the key of the node,
and all keys in the right subtree have key value greater than or equal to
the key of the node.
The subroutine stubs and header file provided are
to be used as the base. You can alter them, and of course if there
are bugs you can fix them.
You can change testapp.cpp to test appropriately, but it must still
be able to interface (i.e., link to) the original testapp.cpp file. Document your changes at the top of your testapp.cpp file in the comments -- i.e., keep a log there of the substantive changes to testapp.cpp
Document the code. The stubs provided are only minimally documented. Don't take them as a model. That said, your instructor is not making a point of grading your documentation per se in this assignment, but if she can't comprehend your code,
then it goes badly for you when she assigns a grade to the work.
Everything but the data files and the makefile should bear your complete name
and student number. Code should be well-documented and well designed.