CSCI 260 Fall 2022: 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 Nov 17 in the lab, for demonstration and git-submit. The instructor will test and provide limited feedback on correctness.

Part II is DUE Nov 25, for submission via git.

In this lab, you are to alter an implementaton of the Dictionary ADT that uses a Binary Search Tree 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 on Thursday November 17.

Also: submit the files via git.

Working Subset 1

  1. The BST is to have the "Find" option enabled within testapp.cpp.
  2. The fields BF and height are to be correctly maintained.
  3. Two other options are to be offered in the testapp menu, LeftRotate and RightRotate. Upon entering "W" or "X", the user is to be prompted for a node to rotate left or rotate right, respectively. Rotating Left at a node v can only be done if there is a right child of the node; in that case the the right child of v becomes the child of v's parent in place of v, and v becomes the left child of v's former right child. A symmetric case holds for rightRotate.
    "Y" and "Z" are for testing your left-right and right-left double rotations, respectively. These two options are not required for the Working Subset 1, but will be incorporated into Working Subset 2


Part II is Assignment 4 and is DUE Nov 25 midnight: