Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Sort(int* mas, int n){
- unsigned long int M = 0, C = 0;
- for (int j = 1; j < n; j++){
- int key = mas[j];
- int chetchik = 0;
- int i = j - 1;
- C++;
- while (i >= 0 && mas[i] > key){
- mas[i + 1] = mas[i];
- i--;
- C++;
- M++;
- chetchik++;
- }
- mas[i + 1] = key;
- }
- if (n != 10) cout << "C = " << C << " M = " << M << "\n";
- }
Add Comment
Please, Sign In to add comment