Computer Science Coursework
CPSC 221 AVL Trees Lab
A UBC CPSC 221 C++ lab for AVL tree implementation. The folder contains avltree.cpp, avltree.h, tests, expected outputs, and tree-printing utilities for checking rotation and balancing behavior.
Period
Mar 2025
Tools / Tech
C++AVL TreeBinary Search TreeRotationsBalancingCatch2
Why I built it
The lab made balancing rules concrete: insertions and removals must preserve both binary-search ordering and height balance.
Links
What it includes
- Implements AVL rotations and balance-factor maintenance.
- Handles insertion and removal while preserving BST ordering.
- Uses tests and printed tree structures to inspect correctness.
What I worked on
- Implemented the AVL tree behavior myself in C++ within the course lab files.
- Reasoned through single and double rotation cases.
- Used expected outputs and tests to debug tree shape changes.
What I Learned
- Strengthened recursive reasoning around tree operations.
- Learned how local rotations preserve global search-tree invariants.
- Practiced debugging algorithms where the data structure shape matters.