MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / InsertSort

Function InsertSort

Arrays/15_InsertSort .c:17–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15}
16
17void InsertSort(struct Array *arr,int x)
18{
19 int i=arr->length-1;
20 if (arr->length==arr->size) return ;
21 while (i>=0 && arr->A[i]>x)
22 {
23 arr->A[i+1]=arr->A[i];
24 i--;
25 }
26
27
28
29 arr->A[i+1]=x;
30
31 arr->length++;
32
33}
34
35
36int main()

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected