• Stars
    star
    5,115
  • Rank 7,721 (Top 0.2 %)
  • Language
    C++
  • License
    MIT License
  • Created about 11 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Algorithms & Data structures in C++.

Algorithms & Data Structures in C++

Build Status

目标 ( goal ) :

  1. 经典的算法实现
    (classical algorithms implementations)
  2. 服务器端
    (based on linux/gcc)
  3. 正确,易于使用和改造, 一个头文件一个算法,并附带一个demo.
    (correct! and ease of use, one .header file per algorithm)

约定 ( Convention ):

  1. 一个算法用一个.h文件表示放到include下. ( one .header file per algorithm. )
  2. 算法演示的demo程序放到src下. ( one demo per algorithm. )
  3. 程序正确通过后,请发起Pull Requests,代码被验证后入库,并在README中发布新算法实现。 (Please Use Fork+Pull Requests !!! Correctness is the most important!)
  4. TAB = 4 space. set ts=4 in vim
  5. Graph的输出格式为 Graphviz Dot格式. (the output format of the graph is in dot of graphviz.) eg: demograph

已实现 ( Implemented ):

Name File
Array shuffle https://github.com/xtaci/algorithms/blob/master/include/shuffle.h
Prime test(trial division) https://github.com/xtaci/algorithms/blob/master/include/prime.h
Prime test(Miller-Rabin's method) https://github.com/xtaci/algorithms/blob/master/include/prime.h
2D Array https://github.com/xtaci/algorithms/blob/master/include/2darray.h
Arbitrary Integer https://github.com/xtaci/algorithms/blob/master/include/integer.h
Linear congruential generator https://github.com/xtaci/algorithms/blob/master/include/random.h
Maximum subarray problem https://github.com/xtaci/algorithms/blob/master/include/max_subarray.h
Bit-Set https://github.com/xtaci/algorithms/blob/master/include/bitset.h
Queue https://github.com/xtaci/algorithms/blob/master/include/queue.h
Stack https://github.com/xtaci/algorithms/blob/master/include/stack.h
Binary Heap https://github.com/xtaci/algorithms/blob/master/include/heap.h
Fibonacci Heap https://github.com/xtaci/algorithms/blob/master/include/fib-heap.h
Priority Queue (list based) https://github.com/xtaci/algorithms/blob/master/include/priority_queue.h
Bubble sort https://github.com/xtaci/algorithms/blob/master/include/bubble_sort.h
Selection sort https://github.com/xtaci/algorithms/blob/master/include/selection_sort.h
Insertion sort https://github.com/xtaci/algorithms/blob/master/include/insertion_sort.h
Shell sort https://github.com/xtaci/algorithms/blob/master/include/shell_sort.h
Radix sort https://github.com/xtaci/algorithms/blob/master/include/radix_sort.h
Quicksort https://github.com/xtaci/algorithms/blob/master/include/quick_sort.h
Merge sort https://github.com/xtaci/algorithms/blob/master/include/merge_sort.h
Double linked list https://github.com/xtaci/algorithms/blob/master/include/double_linked_list.h
Skip list https://github.com/xtaci/algorithms/blob/master/include/skiplist.h
Largest common sequence https://github.com/xtaci/algorithms/blob/master/include/lcs.h
Binary search tree https://github.com/xtaci/algorithms/blob/master/include/binary_search_tree.h
AVL tree https://github.com/xtaci/algorithms/blob/master/include/avl.h
Dynamic order statistics https://github.com/xtaci/algorithms/blob/master/include/dos_tree.h
Red-black tree https://github.com/xtaci/algorithms/blob/master/include/rbtree.h
Interval tree https://github.com/xtaci/algorithms/blob/master/include/interval_tree.h
Prefix Tree(Trie) https://github.com/xtaci/algorithms/blob/master/include/trie.h
Suffix Tree https://github.com/xtaci/algorithms/blob/master/include/suffix_tree.h
B-Tree https://github.com/xtaci/algorithms/blob/master/include/btree.h
Suffix Array https://github.com/xtaci/algorithms/blob/master/include/suffix_array.h
Hash by multiplication https://github.com/xtaci/algorithms/blob/master/include/hash_multi.h
Hash table https://github.com/xtaci/algorithms/blob/master/include/hash_table.h
Universal hash function https://github.com/xtaci/algorithms/blob/master/include/universal_hash.h
Perfect hash https://github.com/xtaci/algorithms/blob/master/include/perfect_hash.h
Java's string hash https://github.com/xtaci/algorithms/blob/master/include/hash_string.h
FNV-1a string hash https://github.com/xtaci/algorithms/blob/master/include/hash_string.h
SimHash https://github.com/xtaci/algorithms/blob/master/include/simhash.h
Bloom Filter https://github.com/xtaci/algorithms/blob/master/include/bloom_filter.h
SHA-1 Message Digest Algorithm https://github.com/xtaci/algorithms/blob/master/include/sha1.h
MD5 https://github.com/xtaci/algorithms/blob/master/include/md5.h
Base64 https://github.com/xtaci/algorithms/blob/master/include/base64.h
Strongly Connected Components(SCC) https://github.com/xtaci/algorithms/blob/master/include/scc.h
Prim's minimum spanning tree https://github.com/xtaci/algorithms/blob/master/include/prim_mst.h
Kruskal MST https://github.com/xtaci/algorithms/blob/master/include/kruskal_mst.h
Breadth First Search https://github.com/xtaci/algorithms/blob/master/include/graph_search.h
Depth First Search https://github.com/xtaci/algorithms/blob/master/include/graph_search.h
Dijkstra's algorithm https://github.com/xtaci/algorithms/blob/master/include/dijkstra.h
Bellman-Ford algorithm https://github.com/xtaci/algorithms/blob/master/include/bellman_ford.h
Edmonds-Karp Maximal Flow https://github.com/xtaci/algorithms/blob/master/include/edmonds_karp.h
Push–Relabel algorithm https://github.com/xtaci/algorithms/blob/master/include/relabel_to_front.h
Huffman Coding https://github.com/xtaci/algorithms/blob/master/include/huffman.h
Word segementation https://github.com/xtaci/algorithms/blob/master/include/word_seg.h
A* algorithm https://github.com/xtaci/algorithms/blob/master/include/astar.h
K-Means https://github.com/xtaci/algorithms/blob/master/include/k-means.h
Knuth–Morris–Pratt algorithm https://github.com/xtaci/algorithms/blob/master/include/kmp.h
Disjoint-Set https://github.com/xtaci/algorithms/blob/master/include/disjoint-set.h
8-Queen Problem https://github.com/xtaci/algorithms/blob/master/include/8queen.h
Palindrome https://github.com/xtaci/algorithms/blob/master/include/palindrome.h
LCA using Binary Lifting https://github.com/xtaci/algorithms/blob/master/include/LCA.h

贡献者 ( Contributors ) :

Samana:  for heavy work of MSVC compatability
wycg1984: for K-Means
xmuliang: for HeapSort, Kruskal MST
wyh267: for base64, LRU, bubble sort, selection sort
ZhangYou0122: Push-Relabel algorithm, Suffix Tree           
UsingtcNower: Suffix Array
afernandez90: AVL trees

More Repositories

1

kcptun

A Stable & Secure Tunnel based on KCP with N:M multiplexing and FEC. Available for ARM, MIPS, 386 and AMD64。N:M 多重化と FEC を備えた KCP に基づく安定した安全なトンネル。 N:M 다중화 및 FEC를 사용하는 KCP 기반의 안정적이고 안전한 터널입니다. Un tunnel stable et sécurisé basé sur KCP avec multiplexage N:M et FEC.
Go
13,605
star
2

kcp-go

A Crypto-Secure, Production-Grade Reliable-UDP Library for golang with FEC
Go
3,879
star
3

gonet

A Game Server Skeleton in golang.
Go
1,243
star
4

smux

A Stream Multiplexing Library for golang with least memory usage(TDMA)
Go
1,214
star
5

gaio

High performance async-io(proactor) networking for Golang。golangのための高性能非同期io(proactor)ネットワーキング
Go
545
star
6

libkcp

FEC enhanced KCP session library for iOS/Android in C++
C
293
star
7

tcpraw

Sending packets through TCP
Go
125
star
8

safebox

One key to derive all
Go
55
star
9

buddha

佛教资料汇集
54
star
10

navmesh

navigation mesh in golang
Go
41
star
11

sp

Stream Processors on Kafka in Golang
Go
29
star
12

chat

pub/sub based chat server
Go
27
star
13

rank

ranking server
Go
23
star
14

sstable

bigdata processing in golang
Go
23
star
15

lossyconn

lossy connection simulator
Go
20
star
16

rewind

Text-Based UI for Kafka
Go
20
star
17

goeval

eval golang code on the fly
Go
15
star
18

log_analysis

Practical Log Analysis
15
star
19

fibernet

Message Queue/C++/Lua based game server
C
15
star
20

wsl-best-practice

best practice for development environment in WSL
14
star
21

notes

personal notes
Go
12
star
22

gogw

Go
9
star
23

auth

auth service
Go
8
star
24

goperf

golang performance benchmarks
Go
7
star
25

bgsave

background save process of redis
Go
7
star
26

serialpacket

net.PacketConn over RS232/LoRa
Go
6
star
27

reorg

A simulated LFN network to mitigate network jitter, reorg trade latency in exchange for smoothness, so as to behave like a long fat but stable network.
Go
5
star
28

tmach

turing machine game
Go
5
star
29

xtaci

4
star
30

json2hive

generate hive schema from a json document
Go
4
star
31

chacha20

an exposed version of https://godoc.org/golang.org/x/crypto/internal/chacha20
Go
4
star
32

kidsmath

a simple program to generate math quizs for my kid.
Go
3
star
33

archiver

redolog archive and replay
Go
3
star
34

serial2tun

Serial To Tun Device
3
star
35

easenet

Automatically exported from code.google.com/p/easenet
C
3
star
36

zturn

(zturn:折腾) a free game brings you back to 1980s
3
star
37

goscm

simple scheme interpreter
Go
1
star
38

poly2tri.as3

Automatically exported from code.google.com/p/poly2tri.as3
ActionScript
1
star
39

logrushooks

hooks for logrus
Go
1
star
40

poly2tri

Automatically exported from code.google.com/p/poly2tri
C++
1
star
41

godeep

machine learning algorithms
1
star
42

ssh-kvr

lex/yacc learning
C
1
star
43

deadlocks

deadlock code snippets in C
C
1
star
44

algebra

notes on algebra learning
1
star
45

log4go

Automatically exported from code.google.com/p/log4go
Go
1
star
46

debris

Shamir's Secret Sharing
1
star
47

ethereum_indexer

A project for indexing and querying ethereum accounts
Go
1
star