项目作者: blackredscarf

项目描述 :
A general and efficient data structures and algorithm template library. https://flak.la
高级语言: C++
项目地址: git://github.com/blackredscarf/flak.git
创建时间: 2019-09-08T13:48:02Z
项目社区:https://github.com/blackredscarf/flak

开源协议:Apache License 2.0

下载




GitHub
PRs Welcome

Flak is a general and efficient data structures and algorithm template library. Implementation in STL style and easy-to-use interface.

Container

A container is a holder object that stores a collection of other objects (its elements). They are implemented as class templates, which allows great flexibility in the types supported as elements.

Associative AVLTree (s) AVLMap (s) (e) AVLSet (s) (e) RBTree (s) RBMap (s)
RBSet (s) HashTable (s) HashMap (s) HashSet (s) SearchTree (s)
KDTree (s) (e) Trie (s) (e)
Sequential Vector (s) List (s) SList (s) PriorityQueue (s)

(s) links to source, (e) links to example.

Algorithm

A collection of functions especially designed to be used on ranges of elements. A range is any sequence of objects that can be accessed through iterators or pointers, such as an array or an instance of some of the containers.

Sort MergeSort (s) (e) InsertionSort (s) (e) QuickSort (s) (e) IntroSort (s) (e) PartialSort (s) (e)
Common RandomShuffle (s) (e) Reverse (s) BinarySearch (s) Merge (s) Partition (s)
RandomizedSelect (s) (e) Heap (s) (e)

Graph

A library contained the graph data structures and algorithms.

Graph AdjacencyList (s) (e)
Algorithm Dijkstra (s) (e) BreadthFirstSearch (s) (e) DepthFirstSearch (s) (e) DisjointSet (s) (e)

Install

Git clone the repository.

  1. git clone https://github.com/blackredscarf/flak

Using CMake to build.

  1. cd flak
  2. mkdir build
  3. cd build
  4. cmake ..
  5. cmake --build ./ --target install --config=Release

Import library to your project. In your CMakeLists.txt:

  1. find_package(flak 1.0.0 REQUIRED)
  2. add_executable(YourLib YourPath/YourSource.cpp)
  3. target_link_libraries(YourLib flak::flak)

Document

Go to flak.la for getting started.

Sample

The AVLMap is implemented by AVLTree.

  1. #include <flak/AVLMap.h>
  2. #include <iostream>
  3. using namespace std;
  4. int main() {
  5. // The interface is same as the STL map
  6. flak::AVLMap<string, int> smap;
  7. smap["jjhou"] = 1;
  8. smap["jerry"] = 2;
  9. smap["jason"] = 3;
  10. smap["jimmy"] = 4;
  11. flak::AVLMap<string, int>::iterator it1 = smap.begin();
  12. for(; it1 != smap.end(); it1++) {
  13. cout << it1->first << " : " << it1->second << endl;
  14. }
  15. smap.erase("jason");
  16. it1 = smap.find("jason");
  17. cout << (it1 == smap.end()) << endl;
  18. }