Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.44 KB

File metadata and controls

67 lines (48 loc) · 1.44 KB

Data Structure & Algorithm (DSA)

Build Status

DSA 是一个包含基础和高级数据结构,以及常用算法的库。我们致力于提供一套完整的,简洁的代码实现所有模块。

Features

  • 现代 C++ 风格(基于 C++17 语法)
  • 完善的注释
  • 接口简单易用
  • 强大的 Debug 能力

How to build

  1. 在根目录执行bash ./build.sh
  2. build/目录下会生成相关的库和可执行文件

Example

下面的例子演示如何通过数组创建一棵二叉树。

#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;
}

Contact

  • QQ

610441700

  • 钉钉群: