DSA is a library of basic and advanced data structures, as well as common algorithms. We are committed to providing a complete and concise set of code to implement all modules.
$ bash ./build.sh
$ cd build && make test
The following is an easy demo showing how to create a binary tree.
#include <iostream>
#include <string_view>
#include "binary_tree.h"
using namespace dsa;
using Tree = BinaryTree<int>;
int main() {
constexpr std::string_view tree_graph = R"(
1 <- right_rotate
/ \
2 3
/ \
4 5
||
2
/ \
4 1
/ \
5 3
)";
// We can build a binary tree from list
Tree tree({1, 2, 3, 4, 5});
std::cout << tree << std::endl;
// Rotate at root
tree.right_rotate(1);
// Print the tree
std::cout << tree << std::endl;
return 0;
}
QQ Group: 610441700
Dingding Group: