This project provides an implementation of an AVL (Adelson-Velsky and Landis) self-balancing binary search tree in C++.
It also includes automated tests comparing the results of the AVL tree with the C++ Standard Library std::set.
- An implementation of an AVL tree with insertion and range queries
- Comparison of results with
std::setfor correctness - Python scripts for automated testing and output verification
Clone this repository, then reach the project directory:
git clone https://github.com/bgclutch/AVL_Tree_Task_cpp.git
cd AVL_Tree_Task_cpp- Build the project:
cmake -B build
cmake --build build- Navigate to the
buildfolder:
cd build- Choose tree to run:
./avltree/avltreeor
./stdset/stdsetFor End To End tests:
1.1 Navigate to the tests directory:
cd tests/EndToEnd1.2 Run default tests with the Python script:
python3 testrun.py1.3 (Optional) Or regenerate test cases:
python3 testgen.pyAnd run it as in step 2.
For unit tests:
2.1 Navigate to the build folder:
cd build- Run unit tests:
./tests/tests- To build the project in benchmark mode:
cmake -DENABLE_BECHMARK=ON -B build
cmake --build build2.1 Run benchmark with default data:
./build/benchmark/benchmark2.2 Or use your data:
./build/benchmark/benchmark "USER'S FILE"Benchmark for 10 tests with 1 million requests in each, using -O2 optimisation
| Data structure | Average execution time, sec |
|---|---|
| AVL Tree | 0.655275 |
| std::set | 473.449269 |