FOSSALGO
FOSSALGO copied to clipboard
Collection of Algorithms and Data Structures
FOSSALGO
The community maintained a list of Algorithms and Data Structures implementations.
Algorithms
| Algorithm | Code |
|
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|---|---|---|
| Bin Sort | ar-binsrt |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| Binary Search | ar-bsrh |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| Boyer–Moore Search | ar-bmss |
✔ | ||||||||
| Breadth First Search | gr-bfsrh |
✔ | ✔ | ✔ | ✔ | ✔ | ||||
| Bubble Sort | ar-bsrt |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| Coin Change Problem | ar-cochprb |
✔ | ✔ | ✔ | ✔ | ✔ | ||||
| Depth First Search | gr-dfsrh |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||
| Dijkstra Algorithm | gr-dij |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||
| Exponentiation by Squaring | ar-expsq |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
| Heap Sort | ar-hsrt |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| Insertion Sort | ar-isrt |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| Knuth–Morris–Pratt | ar-kmp |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| K-NN | ar-knn |
✔ | ✔ | |||||||
| Largest Sum Contiguous Sub-Array | ar-lscsa |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| Linear Regression | ar-lreg |
✔ | ✔ | ✔ | ✔ | ✔ | ||||
| Linear Search | ar-lsrh |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||
| Longest Common Subsequence | ar-lcs |
✔ | ✔ | ✔ | ||||||
| Longest Increasing Subsequence | ar-lis |
✔ | ✔ | ✔ | ||||||
| Longest Palindromic Substring | ar-lps |
✔ | ||||||||
| Merge Sort | ar-msrt |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ||
| Modular Exponential | ar-mexp |
✔ | ✔ | |||||||
| Naive Search | ar-nsrh |
✔ | ✔ | |||||||
| Prime Factor | ar-prfac |
✔ | ✔ | ✔ | ✔ | |||||
| Prims | gr-prims |
|||||||||
| Quick Select | ar-qsel |
|||||||||
| Quick Sort | ar-qsrt |
✔ | ✔ | ✔ | ||||||
| Radix Sort | ar-radsrt |
✔ | ||||||||
| Rod Cutting Problem | ar-rcprb |
|||||||||
| Selection Sort | ar-ssrt |
✔ | ✔ | ✔ | ✔ | |||||
| Shell Sort | ar-shsrt |
✔ | ✔ | ✔ | ✔ | ✔ | ||||
| Sieve of Eratosthenes | ar-soer |
✔ | ||||||||
| Sleep Sort | ar-slpsrt |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
Data Structures
| Data Structure | Code |
|
|
|
|
|
|
|
|
|
|---|---|---|---|---|---|---|---|---|---|---|
| Stack | ds-stk |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
| Queue | ds-que |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
| Circular Queue | ds-cque |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |
| Priority Queue | ds-pque |
✔ | ✔ | ✔ | ✔ | ✔ | ✔ | |||
| Singly Linked-list | ds-slinklst |
✔ | ✔ | ✔ | ✔ | |||||
| Doubly Linked-list | ds-dlinklst |
✔ | ||||||||
| Tree | ds-tree |
|||||||||
| Binary Search Tree | ds-btree |
✔ | ✔ | ✔ | ✔ | ✔ | ||||
| AVL Tree | ds-avltree |
|||||||||
| Red-Black Tree | ds-rbtree |
How to run them
| Language | Steps |
|---|---|
| C | gcc <filename.c> |
| C++ | g++ <filename.cpp> |
| Java | javac <filename.java> |
| Python | python <filename.py> |
| Golang | go run <filename.go> |
| JavaScript | node <filename.js> |
| TypeScript | npm install -g typescript |
| C# | mcs <filename.cs> |
Resources
- Algorithms - Learneroo
- Awesome-Algorithms
- Algorithms List - GeeksforGeeks
- Intro to Algorithms - Khan Academy
- Popular Data Structures and Algorithms - Codechef
- Stanford-ACM-Codes - A list of codes written by previous Stanford ACM team members and coaches.
- Data Structures and Algorithms - A user ranked list of online tutorials to learn Data Structures and Algorithms online.
- Getting Started with Data Structure and Algorithms
Contributing
See CONTRIBUTING.md.
If you plan to suggest a new algorithm or DS, please make sure to read the guidelines.