MCPcopy Create free account
hub / github.com/AdarshAddee/Hacktoberfest2022_for_Beginers / insert

Method insert

Java/InsertionSort.java:4–19  ·  view source on GitHub ↗
(int a[])

Source from the content-addressed store, hash-verified

2public class InsertionSort
3{
4 void insert(int a[])
5 {
6 int i, j, temp;
7 int n = a.length;
8 for (i = 1; i < n; i++) {
9 temp = a[i];
10 j = i - 1;
11
12 while(j>=0 && temp <= a[j])
13 {
14 a[j+1] = a[j];
15 j = j-1;
16 }
17 a[j+1] = temp;
18 }
19 }
20 void printArr(int a[])
21 {
22 int i;

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected