学习或测试常用的数据结构与算法,这个开源项目帮你完成

AlgorithmLibrary A library containing some data structures and algorithms written in c c++ Getting Started Co

AlgorithmLibrary

A library containing some data structures and algorithms written in c/c++.

Getting Started

Compile and run:

$ make

$ make run

For usage, see functionmain().

Data Structure

NameSourceComment

Linked List

LinkedList.h

support sort

Binary Heap

BinaryHeap.h

priority queue

Hash Table

HashTable.h

use bucket list

AVL Tree

AVLTree.h

support balanced insert and remove

Disjoint Set

DisjointSet.h

DisjointSet.cpp

express relation of equivalence

Graph

Graph.h

Graph.cpp

use adjacent list or matrix; node stores nonnegative number

Algorithm

NameSourceComment

Sorting

SortHelper.h

classic sorting algorithms

Random Number Generation

Random.h

Random.cpp

pseudorandom number generation

Arithmetic Expression

ArithmeticExpression.h

ArithmeticExpression.cpp

arithemetic expression calculation

MD5

(CN)

MD5.h

MD5.cpp

message encrypt

N-Puzzle Problem

NPuzzle.h

NPuzzle.cpp

solve using hill climbing

, simulated annealing

, A* search

; GUI demo

; 中文博客

N-Queens Problem

NQueen.h

NQueen.cpp

solve using hill climbing

and simulated annealing

Factorial

Algorithm::factorial()

20! is max (return unsigned long long)

Binary Search

Algorithm::binarySearch()

find first or last appeared position

Permutation

Algorithm::nextPermutation()

non-recursive version

Combination

Algorithm::printCombinations()

non-recursive version

Cantor Expansion

(CN)

Algorithm::cantorExpand()

cantor expansion and its inverse

Prime Number

Algorithm::nextPrime()

find next prime number (choose appropriate buckets number for hash table)

Topological Sort

AlgorithmGraph::topoSort()

check if a graph is cyclic

Dijkstra

AlgorithmGraph::dijkstra()

shortest path

Prim

AlgorithmGraph::prim()

minimum spanning tree

Hungarian

AlgorithmGraph::hungarian()

solve unweighted bipartite graph

matching problem; 中文博客

Kuhn-Munkras

AlgorithmGraph::km()

solve optimal weighted bipartite graph

matching problem; 中文博客

Edmonds–Karp

AlgorithmGraph::EdmondKarp()

solve maximum flow problem

; 中文博客

Utility

NameSourceComment
Timer

Timer.h

Timer.cpp

calculate program execution time

License

Copyright 2016 ChuyangLiu

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

未登录用户
全部评论0
到底啦