|
1 | 1 | ## Contributing |
2 | 2 |
|
3 | | -> Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms. |
4 | | -
|
5 | | -## See |
6 | | - |
7 | | -- [General Rules](#general-rules) |
8 | | -- [All ▲lgorithms Structure](#all-lgorithms-structure) |
9 | | -- [Adding new algorithms](#adding-new-algorithms) |
10 | | -- [Style](#style) |
11 | | -- [Adding Documentation](#adding-documentation) |
12 | | -- [Run it online](#run-it-online) |
13 | | - |
14 | | -### General Rules |
15 | | - |
16 | | -- As much as possible, try to follow the existing format of markdown and code. |
17 | | - |
18 | | -### All ▲lgorithms Structure |
19 | | - |
20 | | -> We follow this structure |
21 | | -
|
22 | | -- Directories and files are all in lower case letter. |
23 | | -- Directories are separated by a minus or hyphen (`-`) following `kebeab-case` style. In libraries this may change to follow the standards of the programming language |
24 | | -- Files are separated by an underscore (`_`) following the `snake_case` style. This could change to follow style standards on some languages like Java where we are using `CamelCase` style. |
25 | | - |
26 | | -``` |
27 | | -├── sorting |
28 | | -│ │── merge_sort.cpp |
29 | | -│ └── insertion_sort.cpp |
30 | | -├── searches |
31 | | -│ │── binary_search.cpp |
32 | | -│ └── linear_search.cpp |
33 | | -└── math |
34 | | - ├── third-algorithm.cpp |
35 | | - └── fourth_algorithm.cpp |
36 | | -``` |
37 | | - |
38 | | -### Adding new algorithms |
39 | | - |
40 | | -- Make your pull requests to be **specific** and **focused**. Instead of contributing "several algorithms" all at once contribute them all one by one separately (i.e. one pull request for "Binary Search", another one |
41 | | -for "Bubble Sort" and so on). |
42 | | -- Describe what you do in code using **comments**. |
43 | | - |
44 | | -### Style |
45 | | - |
46 | | -We are following the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html), make sure you use it in your algorithms implementations. |
47 | | - |
48 | | -If you are lazy to read the Google C++ Style Guide, we already tough about you. You must use the [Tutorial Point Formatter](https://www.tutorialspoint.com/online_c_formatter.htm). **This is only to help you get started, you should double check it again**. See the below example: |
49 | | - |
50 | | -##### Important |
51 | | - |
52 | | -Use: |
53 | | - |
54 | | -```c++ |
55 | | -if() |
56 | | -{ |
57 | | -} |
58 | | -``` |
59 | | - |
60 | | -Instead of: |
61 | | - |
62 | | -```c++ |
63 | | -if() { |
64 | | -} |
65 | | -``` |
66 | | - |
67 | | -Each `.cpp` file should have the following header |
68 | | - |
69 | | -```cpp |
70 | | -// |
71 | | -// Binary search works for a sorted array. |
72 | | -// More documentation about the algorithm |
73 | | -// |
74 | | -// The All ▲lgorithms Project |
75 | | -// |
76 | | -// https://allalgorithms.com/ |
77 | | -// https://github.com/allalgorithms/cpp |
78 | | -// |
79 | | -// Contributed by: Carlos Abraham Hernandez |
80 | | -// Github: @abranhe |
81 | | -// |
82 | | -#include <iostream> |
83 | | -``` |
84 | | - |
85 | | -If the algorithm is modified, this should be included there also. |
86 | | - |
87 | | -```cpp |
88 | | -// https://github.com/allalgorithms/cpp |
89 | | -// |
90 | | -// Contributed by: Carlos Abraham Hernandez |
91 | | -// Github: @abranhe |
92 | | -// |
93 | | -// Modified by: Your Name |
94 | | -// Github: @yourgithubusername |
95 | | -// |
96 | | -``` |
97 | | - |
98 | | -If the algorithm have been modified by multiple contributors, that should be included as follow. |
99 | | - |
100 | | -```cpp |
101 | | -// https://github.com/allalgorithms/cpp |
102 | | -// |
103 | | -// Contributed by: Carlos Abraham Hernandez |
104 | | -// Github: @abranhe |
105 | | -// |
106 | | -// Modifiers: |
107 | | -// Your Name, @yourgithubusername |
108 | | -// Your friend's name, @yourfriendongithub |
109 | | -// |
110 | | -... |
111 | | -``` |
112 | | - |
113 | | -C style should be on the [C repository](https://github.com/allalgorithms/c) so: |
114 | | - |
115 | | -```cpp |
116 | | -#include <stdio.h> |
117 | | -``` |
118 | | - |
119 | | -Should not be included, use instead |
120 | | - |
121 | | -```cpp |
122 | | -#include <cstdio> |
123 | | -``` |
124 | | - |
125 | | -### Adding Documentation |
126 | | - |
127 | | -Please make sure if you add an algorithm, you also add the required documentation for it on [github.com/abranhe/algorithms](https://github.com/abranhe/algorithms), following the [template](https://github.com/abranhe/algorithms/blob/master/.github/category-template/algorithm-template/readme.md). |
128 | | - |
129 | | - |
130 | | -### Run it online |
131 | | - |
132 | | -On the documentation make sure you add a run it online [Repl.it](https://repl.it/). |
133 | | - |
134 | | -If you are modifying an algorithm make sure you add a benchmark using [Repl.it](https://repl.it/). |
135 | | - |
136 | | - |
137 | | -#### Lastly and not less important: |
138 | | - |
139 | | -Make sure you start ⭐️ and follow [@abranhe](https://github.com/abranhe) |
| 3 | +> Please note that this project is released with a [Contributor Code of Conduct](code-of-conduct.md). By participating in this project you agree to abide by its terms. |
0 commit comments