// // ALGORITH.cpp // exercise // // Created by Nurjol Badyelkhan on 2021/03/10. // #include #include using namespace std; void selectionSort(int a[],int n){ for(int i=0;i a[j]){ idx = j; } } int temp = a[idx]; a[idx]=a[i]; a[i]= temp; } } void merge(int a[], int l ,int m,int r) { int i = l; int j = m+1; int k = l; int temp[100000]; while(i<=m && j<=r) { if(a[i]<=a[j]){ temp[k] = a[i]; i++; k++; } else{ temp[k] = a[j]; j++; k++; } } while(i<=m) { temp[k] = a[i]; i++; k++; } while(j<=r) { temp[k] = a[j]; j++; k++; } for(int w= l; w<=r; w++) { a[w] = temp[w]; } } void mergeSort(int a[], int l ,int r){ if (r>l){ int m = (r+l)/2; mergeSort(a, l, m); mergeSort(a, m+1, r); merge(a, l, m, r); } } void checkSort(int a[],int n){ bool sorted; sorted = true; for(int i = 1 ; ia[i]){ sorted = false; cout<