SplayTree
Loading...
Searching...
No Matches

Build Quality Gate Status

Example

#include <iostream>
#include <string>
int main() {
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.PreOrderTraversal([](auto key, auto &value) {
std::cout << key << " -> " << value << std::endl;
});
std::cout << std::endl;
tree.InOrderTraversal([](auto key, auto &value) {
std::cout << key << " -> " << value << std::endl;
});
std::cout << std::endl;
tree.PostOrderTraversal([](auto key, auto &value) {
std::cout << key << " -> " << value << std::endl;
});
std::cout << std::endl;
return 0;
}
Definition: SplayTree.hpp:35
void PreOrderTraversal(Handler handler)
Definition: SplayTree.hpp:178
void PostOrderTraversal(Handler handler)
Definition: SplayTree.hpp:186
void Insert(const Key &key, const Value &value)
Definition: SplayTree.hpp:194
void InOrderTraversal(Handler handler)
Definition: SplayTree.hpp:182

How to Build

Linux & macOS

git clone https://github.com/microsoft/vcpkg.git ~/vcpkg
~/vcpkg/bootstrap-vcpkg.sh
git clone https://github.com/xorz57/SplayTree.git
cd SplayTree
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

git clone https://github.com/microsoft/vcpkg.git C:/vcpkg
C:/vcpkg/bootstrap-vcpkg.bat
C:/vcpkg/vcpkg.exe integrate install
git clone https://github.com/xorz57/SplayTree.git
cd SplayTree
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