You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Have a look at open issues. They contain the list of algorithms/DS we plan to be implemented. Pick an unassigned issue.
You can also create a new issue for an algorithm that is not in the list.
Make sure you are assigned for the issue.
Code the algorithm/DS following the styleguide defined below.
Send a PR.
Be sure to not include any compiled binaries in the patch.
While sending a PR make sure you follow one issue per PR rule.
Suggesting an algorithm / DS
First make sure you are not suggesting a duplicate.
If not, proceed and create the issue. Make sure that you specify only one language in an issue. Create multiple issues for different languages.
Title of issue should be of the following format -
Algorithm/DS Name [Language]
Please include at least one external link for the algorithm/DS in the issue's body for each issue. The link should explain the algorithm/problem/DS in detail.
Code Styleguide
Code submitted should be modular.
Don't use global variables.
Use separate folders for each concept. Folder name should be in full lowercase. If the algorithm/DS name has multiple words, separate them by underscores. (eg longest_common_subsequence)
Filename should be derived from the folder name. (eg longest_common_subsequence becomes longestCommonSubsequence.c or LongestCommonSubsequence.java)
Name of master function of the code should be kept same as filename to the best extent possible.
Prefer classes instead of multiple helper functions (where applicable).
Currently we are accepting contributions in C, C++, C#, Java, Python, Go and JavaScript but other languages may be considered after a discussion.
Define tester code only in main routine.
Use meaningful variable, method and function names and comments.
No profanity.
Use external libraries only when no other solution is possible/plausible.
We have defined skeleton codes for some popular languages below. Please follow them whenever possible.
Standalone points
In some cases, C and C++ implementation will be similar. In that case, only the C implementation must be done.
Improving an implementation
If you feel you can improve upon an implementation, feel free to open an issue discussing the improvements.
package main
import"fmt"// QuickSort sorts an array using QuickSort algorithmfuncQuickSort(array []int) []int {
// Your implementation herereturnarray
}
funcmain() {
array:= []int{2, 3, 0, 4}
sortedArray:=QuickSort(array)
fmt.Println(sortedArray)
}
JavaScript
functionquickSort(arr){/* Your implementation here */}functionmain(){letinput=[2,3,0,4];quickSort(input);for(letxininput){console.log(input[x]+' ');}}main();
C#
using System;publicclassQuickSort{publicstaticvoidDoQuickSort(int[]a){/* Your implementation here... */}publicstaticvoidMain(){int[]arr=newint[]{2,3,0,4};
DoQuickSort(arr);foreach(int element in arr){
Console.Write(element+"");}
Console.WriteLine("");}}