Skip to content

A general and efficient data structures and algorithm template library. https://flak.la

License

Notifications You must be signed in to change notification settings

blackredscarf/flak

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


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.

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

Using CMake to build.

cd flak
mkdir build
cd build
cmake .. 
cmake --build ./ --target install --config=Release

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

find_package(flak 1.0.0 REQUIRED)

add_executable(YourLib YourPath/YourSource.cpp)
target_link_libraries(YourLib flak::flak)

Document

Go to flak.la for getting started.

Sample

The AVLMap is implemented by AVLTree.

#include <flak/AVLMap.h>
#include <iostream>
using namespace std;

int main() {
    // The interface is same as the STL map
    flak::AVLMap<string, int> smap;
    smap["jjhou"] = 1;
    smap["jerry"] = 2;
    smap["jason"] = 3;
    smap["jimmy"] = 4;

    flak::AVLMap<string, int>::iterator it1 = smap.begin();
    for(; it1 != smap.end(); it1++) {
        cout << it1->first << " : " << it1->second << endl;
    }

    smap.erase("jason");
    it1 = smap.find("jason");
    cout << (it1 == smap.end()) << endl;
}

About

A general and efficient data structures and algorithm template library. https://flak.la

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published