Skip to content

Commit 89c3e32

Browse files
committed
Organise folders
1 parent c9542a7 commit 89c3e32

File tree

22 files changed

+192
-0
lines changed

22 files changed

+192
-0
lines changed

.DS_Store

8 KB
Binary file not shown.

Algorithms/.DS_Store

6 KB
Binary file not shown.

CONTRIBUTING.md

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
# Contributing
2+
3+
## How to contribute an implementation (code)?
4+
5+
- Have a look at open issues. They contain the list of algorithms/DS we plan
6+
to be implemented. Pick an unassigned issue.
7+
- You can also create a new issue for an algorithm that is not in the list.
8+
- **Make sure you are assigned for the issue.**
9+
- Code the algorithm/DS following the styleguide defined below.
10+
- Send a PR.
11+
- Be sure to not include any compiled binaries in the patch.
12+
- While sending a PR make sure you follow one issue per PR rule.
13+
14+
## Suggesting an algorithm / DS
15+
16+
- First make sure you are not suggesting a duplicate.
17+
- If not, proceed and create the issue. Make sure that you specify only one
18+
language in an issue. Create multiple issues for different languages.
19+
- Title of issue should be of the following format -
20+
```
21+
[Algo/Data Structure] Algorithm/DS Name [Language]
22+
```
23+
- Please include at least one external link for the algorithm/DS in the
24+
issue's body for each issue. The link should explain the algorithm/problem/DS
25+
in detail.
26+
27+
## Use a Consistent Coding Style
28+
29+
- Code submitted should be modular.
30+
- Don't use global variables.
31+
- Use separate folders for each concept. Folder name should be in full
32+
lowercase. If the algorithm/DS name has multiple words, separate them by
33+
underscores. (eg `longest_common_subsequence`)
34+
- Filename should be derived from the folder name. (e.g,
35+
`longest_common_subsequence` becomes `longest_common_subsequence.c` or
36+
`longest_common_subsequence.java`)
37+
- Name of master function of the code should be kept same as filename to the
38+
best extent possible.
39+
- Prefer classes instead of multiple helper functions (where applicable).
40+
- Currently we are accepting contributions in `C`, `C++`, `Java` and `Python`
41+
but other languages may be considered after a discussion.
42+
- Define `tester` code only in `main` routine.
43+
- Use meaningful variable, method and function names and comments.
44+
- No profanity.
45+
- Use external libraries only when no other solution is possible/plausible.
46+
- We have defined [skeleton codes](#samples-code) for some popular languages
47+
below. Please follow them whenever possible.
48+
49+
## Write Good Commit Messages
50+
51+
A commit message consists of 3 parts:
52+
- shortlog
53+
- commit body
54+
- issue reference
55+
Example:
56+
```
57+
quicksort.py Add QuickSort Algorithm
58+
59+
This adds QuickSort Algorithm which return the concatenation of the
60+
quicksorted list of elements that are less than or equal to the pivot, the
61+
pivot, and the quicksorted list of elements that are greater than the pivot.
62+
63+
Closes https://github.com/NITSkmOS/Algorithms/issues/2
64+
```
65+
66+
### Shortlog
67+
68+
Example:
69+
```
70+
quicksort.py: Add QuickSort Algorithm
71+
```
72+
- **Maximum of 50 characters.**
73+
74+
Keeping subject lines at this length ensures that they are readable, and
75+
explains the change in a concise way.
76+
- Should describe the change - the action being done in the commit.
77+
- Should not include WIP prefix.
78+
- Should have a tag and a short description separated by a colon (`:`)
79+
- **Tag**
80+
- The file or class or package being modified.
81+
- Not mandatory.
82+
83+
- **Short Description**
84+
- Starts with a capital letter.
85+
- Written in imperative present tense (i.e. `Add something`, `not Adding
86+
something` or `Added something`).
87+
- No trailing period.
88+
89+
### Commit Body
90+
91+
Example:
92+
```
93+
This adds QuickSort Algorithm which return the concatenation of the
94+
quicksorted list of elements that are less than or equal to the pivot, the
95+
pivot, and the quicksorted list of elements that are greater than the pivot.
96+
```
97+
- Maximum of 72 chars excluding newline for each line.
98+
99+
The recommendation is to add a line break at 72 characters, so that Git has
100+
plenty of room to indent text while still keeping everything under 80
101+
characters overall.
102+
- Not mandatory - but helps explain what you’re doing.
103+
104+
- Should describe the reasoning for your changes. This is especially important
105+
for complex changes that are not self explanatory. This is also the right place
106+
to write about related bugs.
107+
- First person should not be used here.
108+
109+
### Issue reference
110+
111+
Example:
112+
```
113+
Closes https://github.com/NITSkmOS/Algorithms/issues/2
114+
```
115+
- Should use the `Fixes` keyword if your commit fixes a bug, or `Closes` if it
116+
adds a feature/enhancement.
117+
- In some situations, e.g. bugs overcome in documents, the difference between
118+
`Fixes` and `Closes` may be very small and subjective. If a specific issue may
119+
lead to an unintended behaviour from the user or from the program it should be
120+
considered a bug, and should be addresed with `Fixes`. If an issue is labelled
121+
with `bug` you should always use `Fixes`. For all other issues use `Closes`.
122+
- Should use full URL to the issue.
123+
- There should be a single space between the `Fixes` or `Closes` and the URL.
124+
125+
> **Note:**
126+
> - The issue reference will automatically add the link of the commit in the
127+
issue.
128+
> - It will also automatically close the issue when the commit is accepted into
129+
repository.
130+
131+
## Samples Code
132+
133+
#### C
134+
135+
```c
136+
void quicksort(int ar_size, int *ar) {
137+
/*
138+
Your implementation here...
139+
*/
140+
}
141+
142+
int main() {
143+
int ar_size = 4, i;
144+
int a[4] = {2, 3, 0, 4};
145+
quicksort(ar_size, a);
146+
147+
for (i=0; i<ar_size; i++){
148+
printf("%d\n", a[i]);
149+
}
150+
return 0;
151+
}
152+
```
153+
154+
#### Python
155+
156+
```python
157+
def quicksort(arr):
158+
#
159+
# Your implementation here...
160+
#
161+
162+
163+
def main():
164+
arr = [2, 3, 0, 4]
165+
sorted_arr = quicksort(arr)
166+
print(sorted_arr)
167+
168+
169+
if __name__ == '__main__':
170+
main()
171+
```
172+
173+
#### Java
174+
175+
```java
176+
public class QuickSort {
177+
178+
static void quickSort(int[] a) {
179+
/*
180+
Your implementation here...
181+
*/
182+
}
183+
184+
public static void main(String[] args) {
185+
int[] arr = new int[] {2, 3, 0, 4};
186+
quickSort(arr);
187+
for(int element: arr) {
188+
System.out.println(element);
189+
}
190+
}
191+
}
192+
```
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Data Structures/.DS_Store

10 KB
Binary file not shown.

0 commit comments

Comments
 (0)