ProAlgos-Cpp
ProAlgos-Cpp copied to clipboard
C++ implementations of well-known (and some rare) algorithms, while following good software development practices
ProAlgos: C++
This project is focused on implementing algorithms and data structures in C++, while following good software engineering practices, such as:
- Writing well-documented code
- Adhering to code guidelines
- Writing and passing unit tests
- Reviewing each other's code
Goals
- Implement algorithms and data structures
- Learn to be better software developers
- Guide one another on version control, unit testing, and algorithms
How to get involved
There are a few ways to get involved.
Want to contribute to open-source and get involved with the project?
- Read the contribution guidelines
- Fork the repo
- Create an issue describing what you'd like to add, or claim an issue that's up for grabs
- Create a branch and add your code
- Submit a pull request and reference the issue it closes
You can find more details regarding the steps above in the contribution guidelines, so be sure to check them out.
Just want to suggest a new algorithm or report a bug?
Create a new issue and we'll handle it from there. :smile:
Contents
:white_check_mark: = has unit tests
Algorithms
-
Backtracking
- N-Queens :white_check_mark:
-
Dynamic programming
- 0-1 knapsack :white_check_mark:
- Coin change :white_check_mark:
- Longest decreasing subsequence :white_check_mark:
- Matrix chain multiplication :white_check_mark:
- Maximum sum contiguous subarray: Kadane's algorithm :white_check_mark:
- Rod cutting :white_check_mark:
- Weighted activity selection :white_check_mark:
-
Number theory
- Binomial coefficient :white_check_mark:
- Euclidean algorithms
- Greatest common divisor (GCD) :white_check_mark:
- Extended Euclidean algorithm (Bézout coefficients) :white_check_mark:
- Fast exponentiation :white_check_mark:
- Nth Fibonacci number
- Linear time algorithm :white_check_mark:
- Logarithmic time algorithm :white_check_mark:
- Perfect number check :white_check_mark:
- Prime numbers
- Primorial :white_check_mark:
- Sieve of Eratosthenes (simple) :white_check_mark:
-
Searching
- Binary search :white_check_mark:
- Linear search :white_check_mark:
- Ternary search :white_check_mark:
-
Sorting
- Bubble sort :white_check_mark:
- Bucket sort :white_check_mark:
- Comb sort :white_check_mark:
- Counting sort (stable) :white_check_mark:
- Heap sort :white_check_mark:
- Insertion sort :white_check_mark:
- Merge sort :white_check_mark:
- Quick sort :white_check_mark:
- Radix sort
- Selection sort :white_check_mark:
- Shell sort :white_check_mark:
-
String
- Longest common subsequence :white_check_mark:
- Searching (pattern matching)
- Knuth-Morris-Pratt :white_check_mark:
- Edit Distance Problem :white_check_mark:
- Shunting yard :white_check_mark:
- Permutation
- Heap's Algorithm :white_check_mark:
Data structures
-
Linked List
- Singly linked list :white_check_mark:
- Doubly linked list :white_check_mark:
-
Queue
- Queue :white_check_mark:
-
Set
- Disjoint-set :white_check_mark:
-
Stack
- Stack :white_check_mark:
-
Tree
- Binary search tree :white_check_mark:
- Fenwick tree :white_check_mark:
Compiling
To compile the source files, run make
from the C++
directory. Doing so will create executable binaries in the bin
directory.
To compile and run all tests, run make test
. This will compile all the tests (in the same way as described above) and will run them, displaying the results.
In order to run a specific test and see its results, run it manually from the bin
directory after calling make
. For example, this command (executed from bin
) would run only the unit tests for the N Queens algorithm:
$ ./n_queens
To remove all of the files created during compilation, run make clean
. You need not do this every time you make some changes to a file and want to recompile it. Just run make
and it will re-compile just those files whose contents have changed.
To see what happens in the background during compilation and testing, see the following files:
- Makefile
- CMakeLists.txt
- Testing script
For more information on make
, see the GNU make Manual. For more information on CMake
, see the CMake Tutorial.
Maintainers
This project is actively maintained by @alxmjo, and inactively by @faheel.
License
This project is licensed under the terms of the MIT license.