Skip to content

Commit ae229a9

Browse files
committed
contribution guide + cleanup + new readme
1 parent 99fe7f9 commit ae229a9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2473
-1716
lines changed

.editorconfig

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# EditorConfig
2+
# https://EditorConfig.org
3+
#
4+
# Build with init-editorconfig
5+
# https://github.com/abranhe/init-editorconfig
6+
7+
root = true
8+
9+
[*]
10+
indent_style = space
11+
indent_size = 4
12+
end_of_line = lf
13+
charset = utf-8
14+
trim_trailing_whitespace = true
15+
insert_final_newline = true
16+
17+
[*.yml]
18+
indent_style = space
19+
indent_size = 2

.github/code-of-conduct.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Attribution
36+
37+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
38+
39+
[homepage]: http://contributor-covenant.org
40+
[version]: http://contributor-covenant.org/version/1/4/

.github/contributing.md

+140
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
## Contributing
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
35+
├── third_algorithm.js
36+
└── fourth_algorithm.js
37+
```
38+
39+
### Adding new algorithms
40+
41+
- 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
42+
for "Bubble Sort" and so on).
43+
- Describe what you do in code using **comments**.
44+
45+
### Style
46+
47+
We are following the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html), make sure you use it in your algorithms implementations.
48+
49+
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:
50+
51+
##### Important
52+
53+
Use:
54+
55+
```c++
56+
if()
57+
{
58+
}
59+
```
60+
61+
Instead of:
62+
63+
```c++
64+
if() {
65+
}
66+
```
67+
68+
Each `.cpp` file should have the following header
69+
70+
```cpp
71+
//
72+
// Binary search works for a sorted array.
73+
// More documentation about the algorithm
74+
//
75+
// The All ▲lgorithms Project
76+
//
77+
// https://allalgorithms.com/cpp/category/algorithm
78+
// https://github.com/allalgorithms/cpp
79+
//
80+
// Contributed by: Carlos Abraham Hernandez
81+
// Github: @abranhe
82+
//
83+
#include <iostream>
84+
```
85+
86+
If the algorithm is modified, this should be included there also.
87+
88+
```cpp
89+
// https://github.com/allalgorithms/cpp
90+
//
91+
// Contributed by: Carlos Abraham Hernandez
92+
// Github: @abranhe
93+
//
94+
// Modified by: Your Name
95+
// Github: @yourgithubusername
96+
//
97+
```
98+
99+
If the algorithm have been modified by multiple contributors, that should be included as follow.
100+
101+
```cpp
102+
// https://github.com/allalgorithms/cpp
103+
//
104+
// Contributed by: Carlos Abraham Hernandez
105+
// Github: @abranhe
106+
//
107+
// Modifiers:
108+
// Your Name, @yourgithubusername
109+
// Your friend's name, @yourfriendongithub
110+
//
111+
...
112+
```
113+
114+
C style should be on the [C repository](https://github.com/allalgorithms/c) so:
115+
116+
```cpp
117+
#include <stdio.h>
118+
```
119+
120+
Should not be included, use instead
121+
122+
```cpp
123+
#include <cstdio>
124+
```
125+
126+
### Adding Documentation
127+
128+
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).
129+
130+
131+
### Run it online
132+
133+
On the documentation make sure you add a run it online [Repl.it](https://repl.it/).
134+
135+
If you are modifying an algorithm make sure you add a benchmark using [Repl.it](https://repl.it/).
136+
137+
138+
#### Lastly and not less important:
139+
140+
Make sure you start ⭐️ and follow [@abranhe](https://git.io/abranhe)

.github/issue_template.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!--------------------------------------------------------
2+
3+
Thanks for contributing to the All ▲lgorithms Project
4+
5+
Make sure you fill the require information
6+
---------------------------------------------------------->
7+
8+
This issue is: <!-- THIS IS REQUIRE -->
9+
10+
<!-- Mark one by adding an [x] -->
11+
12+
- [ ] A new Algorithm
13+
- [ ] An update to an existing algorithm.
14+
- [ ] An error found
15+
- [ ] A proposal
16+
- [ ] A question
17+
- [ ] Other (Describe below*)
18+
19+
**Description:**
20+
21+
<!-- THIS IS NOT REQUIRE unless you have selected other -->

.github/pull_request_template.md

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!--------------------------------------------------------
2+
3+
Thanks for contributing to the All ▲lgorithms Project
4+
5+
Make sure you fill the require information
6+
---------------------------------------------------------->
7+
8+
This pull request is: <!-- THIS IS REQUIRE -->
9+
10+
<!-- Mark one by adding an [x] -->
11+
12+
- [ ] A new Algorithm
13+
- [ ] An update to an existing algorithm.
14+
- [ ] An error fix
15+
- [ ] Other (Describe below*)
16+
17+
This pull request fixes:
18+
19+
<!-- Enter the issue number which this pull request fixes -->
20+
21+
**Changes:**
22+
23+
<!-- Make sure you follow the contributing and code of conduct of this project -->

LICENSE

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
MIT License
22

3-
Copyright (c) 2018 Abraham Hernandez ([email protected])
3+
Copyright (c) 2018 All Algorithms and its contributors (allalgorithms.com)
4+
Copyright (c) 2018 Abraham Hernandez <[email protected]> (abranhe.com)
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

+100-19
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<div align="center">
2-
<img width="400" height="270" src="http://konpa.github.io/devicon/devicon.git/icons/cplusplus/cplusplus-original.svg" alt="C Plus Plus Logo">
2+
<img width="400" height="270" src="http://konpa.github.io/devicon/devicon.git/icons/cplusplus/cplusplus-original.svg">
33
<br>
44
<br>
55
<img src="https://cdn.abranhe.com/projects/algorithms/algorithms.svg" width="400px">
66
<br>
77
<br>
8-
<p>All ▲lgorithms implemented in C Plus Plus</p>
9-
<a href="https://algorithms.abranhe.com"><img src="https://img.shields.io/badge/All-%E2%96%B2llgorithms-700606.svg"></a>
8+
<p>All ▲lgorithms implemented in C++</p>
9+
<a href="https://algorithms.abranhe.com"><img src="https://cdn.abranhe.com/projects/algorithms/badge.svg"></a>
1010
<a href="https://github.com/abranhe/algorithms/blob/master/LICENSE"><img src="https://img.shields.io/github/license/abranhe/algorithms.svg" /></a>
1111
<a href="https://cash.me/$abranhe"><img src="https://cdn.abraham.gq/badges/cash-me.svg"></a>
1212
<a href="https://www.patreon.com/abranhe"><img src="https://cdn.abraham.gq/badges/patreon.svg" /></a>
@@ -19,28 +19,109 @@
1919

2020
## Contents
2121

22-
- [Arithmetic Analysis](arithmetic-analysis)
23-
- [File Transfer Protocol](file-transfer-protocol)
24-
- [Greedy Algorithms](greedy-algorithms)
25-
- [Graphs](graphs)
26-
- [Math](math)
27-
- [Neutral Network](neutral-network)
28-
- [Ciphers](ciphers)
29-
- [Data Structures](data-structures)
30-
- [Dynamic Programming](dynamic-programming)
31-
- [Hashes](hashes)
32-
- [Searches](searches)
33-
- [Sorting](sorting)
34-
- [Strings](strings)
35-
- [Traversals](traversals)
22+
- [Artificial Intelligence](#artificial-intelligence)
23+
- [Backtracking](#backtracking)
24+
- [Bit Manipulation](#bit-manipulation)
25+
- [Cellular Automaton](#cellular-automaton)
26+
- [Ciphers](#ciphers)
27+
- [Computational Geometry](#computational-geometry)
28+
- [Cryptography](#cryptography)
29+
- [Data Structures](#data-structures)
30+
- [Divide and conquer](#divide-and-conquer)
31+
- [Dynamic Programming](#dynamic-programming)
32+
- [Gaming Theory](#gaming-theory)
33+
- [Graphs](#graphs)
34+
- [Greedy Algorithms](#greedy-algorithms)
35+
- [Math](#math)
36+
- [Networking](#networking)
37+
- [Numerical Analysis](#numerical-analysis)
38+
- [Operating system](#operating-system)
39+
- [Randomized Algorithms](#randomized-algorithms)
40+
- [Searches](#searches)
41+
- [Selections Algorithms](#selections-algorithms)
42+
- [Sorting](#sorting)
43+
- [Strings](#strings)
44+
- [Online Challenges](#online-challenges)
45+
- [Others](#others)
46+
47+
## Data Structures
48+
49+
- Queue
50+
- [Circular Buffer](data-structures/queue/circular_buffer.cpp)
51+
- [Queue](data-structures/queue/queue.cpp)
52+
- Stack
53+
- [Stack](data-structures/stack/stack.cpp)
54+
55+
## Dynamic Programming
56+
57+
- [Coin Change](dynamic-programming/coin_change.cpp)
58+
- [Edit Distance](dynamic-programming/edit_distance.cpp)
59+
- [Knapsack](dynamic-programming/knapsack.cpp)
60+
- [Longest common subsequence](dynamic-programming/lcs.cpp)
61+
- [Longest Path](dynamic-programming/longest_path.cpp)
62+
- [Ways to Cover](dynamic-programming/ways_to_cover.cpp)
63+
64+
## Graphs
65+
66+
- [Bellman Ford](graphs/bellman_ford.cpp)
67+
- [Breadth-first search](graphs/bfs.cpp)
68+
- [Count Disconnected Components](graphs/count_disconnected_components.cpp)
69+
- [Depth-first search](graphs/dfs.cpp)
70+
- [Dijkstra](graphs/dijkstra.cpp)
71+
- [Floyed Warshall](graphs/floyd_warshall.cpp)
72+
- [Prims Adjacency List](graphs/prims_adjacency_list.cpp)
73+
74+
## Math
75+
76+
- [Collatz](math/collatz.cpp)
77+
- [Euclids Greatest common divisor](math/euclids_gcd.cpp)
78+
- [Factorial](math/factorial.cpp)
79+
- [Greatest common divisor of array](math/gcd_of_array.cpp)
80+
- [Least common multiple of array](math/lcm_of_array.cpp)
81+
- [Lucky Numbers](math/lucky_numbers.cpp)
82+
- [Modular Exponentiations](math/modular_exponentiations.cpp)
83+
84+
## Searches
85+
86+
- [Binary Search](searches/binary_search.cpp)
87+
- [Jump Search](searches/jump_search.cpp)
88+
- [Linear Search](searches/linear_search.cpp)
89+
90+
## Sorting
91+
92+
- [Bubble Sort](sorting/bubble_sort.cpp)
93+
- [Heap Sort](sorting/heap_sort.cpp)
94+
- [Insertion Sort](sorting/insertion_sort.cpp)
95+
- [Merge Sort](sorting/merge_sort.cpp)
96+
- [Quick Sort](sorting/quick_sort.cpp)
97+
- [Selection Sort](sorting/selection_sort.cpp)
98+
- [Sort Vector](sorting/sort_vector.cpp)
99+
100+
## Strings
101+
102+
- [Anagram Check](strings/anagram_check.cpp)
103+
- [Lexicographic Ranking](strings/lexicographic_ranking.cpp)
104+
- [Longest Palindrome Subset](strings/longest_palindrome_subset.cpp)
105+
- [Naive Search](strings/naive_search.cpp)
106+
- [Permutations of string](strings/permutations_of_string.cpp)
107+
- [Print duplicate string](strings/print_duplicate_string.cpp)
108+
- [Rabin Karp](strings/rabin_karp.cpp)
109+
- [Remove Adjacent Duplicates](strings/remove_adjacent_duplicates.cpp)
110+
- [Remove Duplicates](strings/remove_duplicates.cpp)
111+
- [Reverse String](strings/reverse_string.cpp)
36112

37113
## License
38114

39115
This work is licensed under a [MIT License](https://github.com/abranhe/algorithms/blob/master/LICENSE)
40116

41-
[![MIT IMG][mit-license]]((https://github.com/abranhe/algorithms/blob/master/LICENSE))
117+
[![MIT IMG](https://cdn.abraham.gq/projects/algorithms/mit-license.png)](https://github.com/abranhe/algorithms/blob/master/LICENSE)
42118

43119
To the extent possible under law, [Carlos Abraham](https://go.abranhe.com/github) has waived all copyright and related or neighboring rights to this work.
44120

45121

46-
[mit-license]: https://cdn.abraham.gq/projects/algorithms/mit-license.png
122+
<div align="center">
123+
<a href="https://github.com/abranhe/algorithms">
124+
<img src="https://cdn.abranhe.com/projects/algorithms/logo.svg" width="50px">
125+
</a>
126+
<br>
127+
</div>

0 commit comments

Comments
 (0)