We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 01e815b commit 467b495Copy full SHA for 467b495
InsertionSort/java/insertionsort.java
@@ -0,0 +1,17 @@
1
+class InsertionSort{
2
+ public static int[] insertionSort(int[] inputArray){
3
+ int n = inputArray.length;
4
+
5
+ for (int i = 1; i < n; i++){
6
+ key = inputArray[i];
7
+ int j = i-1;
8
9
+ while (j >= 0 && inputArray[j]>key){
10
+ inputArray[j+1] = inputArray[j];
11
+ j = j -1;
12
+ }
13
+ inputArray[j+1] = key;
14
15
+ return inputArray;
16
17
+}
InsertionSort/python]/insertionSort.py
0 commit comments