https://github.com/xorz57/avltree
AVL Tree written in C++14
https://github.com/xorz57/avltree
avl-tree cpp cpp-library cpp14 cpp14-library data-structures datastructures header-only header-only-library tree
Last synced: 3 months ago
JSON representation
AVL Tree written in C++14
- Host: GitHub
- URL: https://github.com/xorz57/avltree
- Owner: xorz57
- License: mit
- Created: 2023-07-27T12:32:11.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-09T22:19:18.000Z (11 months ago)
- Last Synced: 2025-01-12T23:41:07.255Z (4 months ago)
- Topics: avl-tree, cpp, cpp-library, cpp14, cpp14-library, data-structures, datastructures, header-only, header-only-library, tree
- Language: C++
- Homepage: https://xorz57.github.io/AVLTree
- Size: 225 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# AVLTree
[](https://github.com/xorz57/AVLTree/actions/workflows/Build.yml)
[](https://sonarcloud.io/summary/new_code?id=xorz57_AVLTree)## Example
```cpp
#include "AVLTree/AVLTree.hpp"#include
#includeint main() {
avl_tree_t tree;tree.insert(2, "two");
tree.insert(4, "four");
tree.insert(90, "ninety");
tree.insert(3, "three");
tree.insert(0, "zero");
tree.insert(14, "fourteen");
tree.insert(45, "forty-five");tree.pre_order_traversal([](auto key, auto &value) {
std::cout << key << " -> " << value << std::endl;
});
std::cout << std::endl;tree.in_order_traversal([](auto key, auto &value) {
std::cout << key << " -> " << value << std::endl;
});
std::cout << std::endl;tree.post_order_traversal([](auto key, auto &value) {
std::cout << key << " -> " << value << std::endl;
});
std::cout << std::endl;return 0;
}
```## How to Build
#### Linux & macOS
```bash
git clone https://github.com/microsoft/vcpkg.git ~/vcpkg
~/vcpkg/bootstrap-vcpkg.shgit clone https://github.com/xorz57/AVLTree.git
cd AVLTree
cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=~/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config Release
ctest --build-config Release
```#### Windows
```powershell
git clone https://github.com/microsoft/vcpkg.git C:/vcpkg
C:/vcpkg/bootstrap-vcpkg.bat
C:/vcpkg/vcpkg.exe integrate installgit clone https://github.com/xorz57/AVLTree.git
cd AVLTree
cmake -B build -DCMAKE_BUILD_TYPE=Release -S . -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
cmake --build build --config Release
ctest --build-config Release
```