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

Function sorty

CPP/sorting/selectionsort.cpp:5–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3
4
5void sorty(int arr[],int n){
6 for(int i=0;i<n-1;i++){
7 int key=i;
8 for(int j=i+1;j<n;j++){
9 if(arr[j]<arr[key]){
10 key=j;
11
12 }
13 }
14 swap(arr[key],arr[i]);
15 }
16}
17signed main(){
18 int arr[]={3,2,1,5,4};
19 int n=sizeof(arr)/sizeof(int);

Callers 1

mainFunction · 0.85

Calls 1

swapFunction · 0.70

Tested by

no test coverage detected