Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for all data structures and algorithmic functions #59

Open
faheel opened this issue May 29, 2017 · 26 comments
Open

Add documentation for all data structures and algorithmic functions #59

faheel opened this issue May 29, 2017 · 26 comments

Comments

@faheel
Copy link
Member

faheel commented May 29, 2017

Add a README to each directory containing proper documentation for algorithms or data structures in that directory.

@sriram-25
Copy link

sriram-25 commented Jun 3, 2017

What all should the documentation contain? For eg. Time Complexity,Working of the Algorithm?
@faheel

@faheel
Copy link
Member Author

faheel commented Jun 4, 2017

For now the documentation will not include the working details of the algorithm but only information about the "interface" of various functions, i.e. about:

  • what the function does,
  • its inputs,
  • its output (return value), if any,

along with (wherever necessary),

  • time complexity,
  • space complexity.

The inputs, variables and output will have their type, name and a single line description. The time and space complexity will be of the best and worst cases (and average case too, if necessary).

For example, for Kadane.cpp the documentation could look like:


maximumSubarray

<description of what the function does in 1-2 lines>

Input

  • values

    Type: const vector<int> &

    <description in 1-2 lines>

Output

  • tuple of maxSum, start, end

    Type: tuple<int, size_t, size_t>

    <description of maxSum in 1-2 lines>
    <description of start in 1-2 lines>
    <description of end in 1-2 lines>

Time complexity

  • Worst case

    O(N), where N is the size of values
  • Best case

    O(N), where N is the size of values

Markdown for the above documentation:

## `maximumSubarray`
<description of what the function does in 1-2 lines>

### Input
- #### `values`
  Type: `const vector<int> &`

  <description in 1-2 lines>

### Output
- #### tuple of `maxSum`, `start`, `end`
  Type: `tuple<int, size_t, size_t>`

  <description of `maxSum` in 1-2 lines>
  <description of `start` in 1-2 lines>
  <description of `end` in 1-2 lines>

### Time complexity
- #### Worst case
  _O_(**N**), where **N** is the size of `values`
- #### Best case
  _O_(**N**), where **N** is the size of `values`

@faheel
Copy link
Member Author

faheel commented Jul 21, 2017

Issue #74 is now closed

@faheel
Copy link
Member Author

faheel commented Jul 21, 2017

This task can be automated using Doxygen.

@faheel faheel pinned this issue Jun 2, 2019
@stale
Copy link

stale bot commented Jul 31, 2019

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Inactive label Jul 31, 2019
@faheel faheel removed the Inactive label Aug 1, 2019
@stale
Copy link

stale bot commented Sep 30, 2019

This issue has been automatically marked as inactive because it has not had recent activity. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Inactive label Sep 30, 2019
@stale stale bot closed this as completed Oct 15, 2019
@alxmjo alxmjo removed the Inactive label Oct 15, 2019
@alxmjo alxmjo reopened this Oct 15, 2019
@ghost
Copy link

ghost commented Jan 5, 2020

I can definitely get start on this, if it's still open.

@chhawip
Copy link

chhawip commented Feb 5, 2020

@faheel is this issue still up for grab? I can definitely contribute to it.

@faheel
Copy link
Member Author

faheel commented Feb 7, 2020

@safderareepattamannil and @itz-me9 Sorry for the late response. Yes, this issue is up for grabs and your contributions are welcome.

@LuisFerTR
Copy link
Contributor

For now the documentation will not include the working details of the algorithm but only information about the "interface" of various functions, i.e. about:

  • what the function does,
  • its inputs,
  • its output (return value), if any,

along with (wherever necessary),

  • time complexity,
  • space complexity.

The inputs, variables and output will have their type, name and a single line description. The time and space complexity will be of the best and worst cases (and average case too, if necessary).

For example, for Kadane.cpp the documentation could look like:

maximumSubarray

<description of what the function does in 1-2 lines>

Input

  • values

    Type: const vector<int> &
    <description in 1-2 lines>

Output

  • tuple of maxSum, start, end

    Type: tuple<int, size_t, size_t>
    <description of maxSum in 1-2 lines>
    <description of start in 1-2 lines>
    <description of end in 1-2 lines>

Time complexity

  • Worst case

    O(N), where N is the size of values
  • Best case

    O(N), where N is the size of values

Markdown for the above documentation:

## `maximumSubarray`
<description of what the function does in 1-2 lines>

### Input
- #### `values`
  Type: `const vector<int> &`

  <description in 1-2 lines>

### Output
- #### tuple of `maxSum`, `start`, `end`
  Type: `tuple<int, size_t, size_t>`

  <description of `maxSum` in 1-2 lines>
  <description of `start` in 1-2 lines>
  <description of `end` in 1-2 lines>

### Time complexity
- #### Worst case
  _O_(**N**), where **N** is the size of `values`
- #### Best case
  _O_(**N**), where **N** is the size of `values`

I can help with this, is still open? Any changes about what documentation should contain?

@alxmjo
Copy link
Collaborator

alxmjo commented Jun 9, 2020

@LuisFerTR Great! See the readme for backtracking for a guide for how to implement this.

In order to avoid duplicate work, though, please create a new issue describing which section of this you'll take (number_theory, sorting, etc.).

I'm going to leave this issue as Up for grabs since different people can take different parts of it (by opening specific issues referencing what they'd like to do).

@100sarthak100
Copy link
Contributor

100sarthak100 commented Jun 10, 2020

@faheel is this issue still up for grabs?
I can add documentation for dynamic programming.

@alxmjo
Copy link
Collaborator

alxmjo commented Jun 10, 2020

@100sarthak100 Great! Just create a new issue for that particular section, as @LuisFerTR has done.

@ghost
Copy link

ghost commented Jun 16, 2020 via email

@alxmjo
Copy link
Collaborator

alxmjo commented Jun 16, 2020

Hi @ivy-2000. You are on the right track. More specifically, the algorithms in this project are implemented as header files (ending in .hpp). These algorithms are then called from test files (ending in .cpp).

The complicating factor with the sorting algorithms is that we have one test file for all sorting algorithms (sorting.cpp) since we can test all of our sorting algorithms in the same way (and so don't need different .cpp files for each sorting algorithm).

But none of that should concern you. To call bubble_sort, for example, all you need to know is that the function takes three inputs:

  1. A reference to the vector to be sorted
  2. An integer indicating the order (increasing or decreasing)
  3. A boolean indicating whether or not to show state.

Note that those last two parameters have default values (1 and false, respectively), so that one could call the function by just passing in a reference to the vector to be sorted and the function would "assume" (based on the default values) that you wanted it sorted increasing and without showing state.

If you want to play around with this a bit, try copying and importing bubble_sort.hpp into your own program and then calling bubble_sort() to sort your own vector. Create your own main.cpp (on your own desktop, for example) and do something like this:

#include "bubble_sort.hpp" // which you've copied from Algos-Cpp and put into the same directory as your main.cpp file

int main() {
    vector<int> nums{4, 6, 1, 23, 2};
    bubble_sort(nums, 1, true);
}

Playing around with it is probably the only way to really figure out what's going on.

@vanichitkara
Copy link

Is this issue still up for grab? I can work on it!

@alxmjo
Copy link
Collaborator

alxmjo commented Sep 13, 2020

Is this issue still up for grab? I can work on it!

Yep!

@rishabhp99
Copy link

I would like to work on this if this issue is till up for grab.

@ghost ghost mentioned this issue Oct 1, 2020
@alxmjo
Copy link
Collaborator

alxmjo commented Oct 4, 2020

I would like to work on this if this issue is till up for grab.

As long as there's documentation to be completed it's up for grabs. 🙂

@abarbee129
Copy link

I would love to work on the number theory documentation if it is still available.

@abarbee129
Copy link

Hey I have a small change to make and I would like to make a pull request. I know the mechanics, but I don't know the best practices. Additionally I'm very very new to open source. Is anyone willing to help me with the process.

@alxmjo
Copy link
Collaborator

alxmjo commented Dec 2, 2020

@abarbee129 Definitely up for grabs. Read through our documentation and then let me know if you have any questions. 🙂

@abarbee129
Copy link

abarbee129 commented Dec 9, 2020

@alxmjo
I tried to push a small typo change to origin but I got an error because permission was denied to me. Can you help me with that?
The error says Permission to ProAlgos/ProAlgos-Cpp.git denied to abarbee129.

@alxmjo
Copy link
Collaborator

alxmjo commented Dec 9, 2020

@alxmjo
I tried to push a small typo change to origin but I got an error because permission was denied to me. Can you help me with that?
The error says Permission to ProAlgos/ProAlgos-Cpp.git denied to abarbee129.

You should be pushing to your own fork, not directly to ProAlgos. What exact commands did you use to try to push?

@vedsom
Copy link

vedsom commented Oct 1, 2022

@faheel, @alxmjo I want to add documentation for linked list under hactoberfest 2022

@Arna03v
Copy link

Arna03v commented May 25, 2023

Hi @alxmjo @faheel, i noticed there is no documentation for Radix sort, can i go ahead and work on it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests