Coder Social home page Coder Social logo

proalgos / proalgos-cpp Goto Github PK

View Code? Open in Web Editor NEW
504.0 28.0 363.0 747 KB

C++ implementations of well-known (and some rare) algorithms, while following good software development practices

License: MIT License

C++ 96.64% Makefile 0.16% CMake 3.10% Shell 0.10%
algorithms data-structures proalgos algos algorithm cpp cpp11 cpp14 cpp17 datastructures

proalgos-cpp's Introduction

ProAlgos: C++

Travis status

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

  1. Implement algorithms and data structures
  2. Learn to be better software developers
  3. 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?

  1. Read the contribution guidelines
  2. Fork the repo
  3. Create an issue describing what you'd like to add, or claim an issue that's up for grabs
  4. Create a branch and add your code
  5. 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. ๐Ÿ˜„

Contents

โœ… = has unit tests

Algorithms

Data structures

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:

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.

proalgos-cpp's People

Contributors

100sarthak100 avatar a-moreira avatar ahmad307 avatar alxmjo avatar assasch avatar b1z0n avatar coleseverson avatar cssartori avatar ddugovic avatar devrin avatar eskeype avatar faheel avatar faraazahmad avatar hafraz07 avatar hefty-head avatar hossam-tarek avatar ilayaraja97 avatar janos-laszlo avatar jzisheng avatar khushman1 avatar louisebc avatar luisfertr avatar physicsuofraui avatar rajiv2605 avatar realanishsharma avatar rjstyles avatar rushyendher avatar satch97 avatar sumit9696 avatar varunjm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

proalgos-cpp's Issues

String Processing Algorithms

Hi,
What about String Processing Algorithms, such as the classic Knuth-Morris-Pratt (KMP) and the Needleman-Wunsch? Can I work on those to add to the project?

Tests

I'm interested in writing test code for these algorithms, will as much code coverage as possible. Is that something you would like to have in this project?

Heap sort

Hey I'm Satchin, a fellow CE student, I noticed there weren't any algorithms in the repo/pull for heapsort and a few other.

  • May I take the task up of adding this?

  • And if there are any others do I just simply create the pull request for each?

Unit tests

Add unit tests for the following programs:

  • N-Queens
  • Kadane
  • LCS
  • KMP
  • Searching
    • Common test for linear search and binary search
    • Ternary search*
  • Sorting
    • Common test
    • Radix sort

* Ternary search currently has a unit test but it needs to be refactored.

Size of input should be a natural number

Sorting programs may crash if size of input values is negative.
Modify the function getInputSize to check that size >= 0. In case it's not, then display:

Invalid input size! Try again.

and prompt to input size again (through a recursive call to getInputSize).

Also add a condition, that if size is 0, the program should display:

Nothing to sort here.

and exit.

Fast Power Algorithm

Fast Power algorithm isn't present in "Number Theory" folder. It's an algorithm for calculating exponentiation in O(log(N)) time.
I'd like to contribute by adding it.

Basic BigInteger class to handle big numbers of arbitrary length

Create a data structure that can handle numbers of arbitrary length by writing a BigInteger class that supports the following basic mathematical functions:

  • add
  • subtract
  • multiply
  • divide
  • modulo

by overloading existing operators for each function (+, -, *, /, %)

The class should also use overloaded >> and << operators to get input from the standard input stream (std::cin) and to write output to the standard output stream (std::cout) respectively.

The path for the file that contains the class should be DataStructures/BigInteger/BigInteger.hpp

Linked list algorithms

There is no linked list data structure present here. Can I add some commonly used linked list algorithms like reversing a linked list, floyd-cycle finding algortithm etc.

B+ Trees

I would like to add code for B+ trees that supports insertion, traversal, and key search.

Radix Sort

Hello, I noticed you don't have radix sort in here. Would you mind me contributing one?

Red-black trees

I will implement the RedBlack trees and its important features

Merging two Binary Search Trees

I would like to add an algorithm to merge two balanced Binary Search Trees in O(M+N) time, where M is number of nodes in first tree and N is number of nodes in second tree.

make algorithms generic (templated)

I notice it seems like all the functions that implement algorithms take in a specific container as part of the argument (std::vector it seems like). I think these functions should be templated and made generic. If the container cannot be worked on by the function then a compile error should occur.

Mention time and space complexities in comments

For each algorithm, mention its time complexity and space complexity in the "description comment" of its implementation program.

The format for the "description comment" (which is written at the beginning) should be:

/*
    <Name of algorithm>
    -------------------
    <Brief description>

    Time complexity
    ---------------
    O(...), where <description of variable(s)>    
    
    Space complexity
    ----------------
    O(...), where <description of variable(s)>
*/

Following are the algorithms for which time and space complexity hasn't been added yet:

  • N-Queens
  • Kadane
  • Binary search
  • Bubble sort
  • Counting sort
  • Insertion sort
  • Merge sort
  • Quick sort
  • Selection sort

String algorithms

An issue for adding string algorithms -> Z algo, Manachers algo, Rabin-Karp algo.
If you are good with it, I can add them.

Bit Manipulation algorithms

I would like to implement bit manipulation algorithms, is this something that would fit well with your project? If so, let me know how you would like the files organized and I'll be happy to get started!

Add general contributing guidelines

Create CONTRIBUTING.md containing general contributing guidelines like adding description comment to each file, links to language-specific coding guidelines such as C++ Coding Guidelines, and more.

Matrix Chain Multiplication

Given n matrices A1, A2, ..., An, to be multiplied, determine how to parenthesize the matrices to minimize the total number of multiplications.

(This would be my first contribution, so I had some questions, and also would it work if I code it in Java? Thanks :) )

Wiki's content is not working

When I click on the links provided in "contents" page, it takes me to 404 error. I think it should be fixed.
I've also realized that it's not up to date.

Point QuadTree

I see that there are no point quad tree implementation here. Can I give it a go?

Bucket sort

Hey,
Bucket sort is not included . I would like to include it too.
Also according to issue #36 radix sort is still not there, I would like to add that too.

Depth First Search

I couldn't find if DFS is done before, if not, I could totally do that. (In java if possible)
Thanks

Construct Mirror Tree

I would like to implement the algorithm for constructing a mirror tree for given binary tree.

Add graph traversal algorithms

Create a folder named Graph in the root directory. Inside it, the following graph traversal algorithms are to be added:

Use either an adjacency list (recommended) or an adjacency matrix to implement an undirected weighted graph.

Use STL containers such as std::queue and std::stack for implementing a queue and stack respectively.

Create a header file named Graph.h (in DataStructures/Graph) and implement the basic functions for getting inputs from the user, such as:

  • number of vertices
  • number of edges
  • starting vertex
  • edge info (source, destination and weight)

Graph algorithms

Hello, do you have any graph algorithms implemented. I'd like to contribute with some if u haven't. I'll try to add one algo per week.

Implement data validation

Could we add some data validation functions such as,
make upper case,
make lower case,
get random double,
get random int?

Linked list

Hello, I could add a template LinkedList I made some time ago for my Data Structures and Algs class, updated for C++11 of course. It would require adding both a .cpp and an interface file if that's alright.

Primorial

Implement an algorithm for calculating the primorial of a given prime number Pn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.