Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void swap(int *a, int *b){
- if(a != b){
- int t = *a;
- *a = *b;
- *b = *t;
- }
- }
- int *max(int *arr, int size){
- int *m = arr + (--size);
- while(size--)
- if(*m > arr[size]) m = arr + size;
- return m;
- }
- void max_sort(int *arr, int size){//сортировка по убыванию "максимумами"
- swap(max(arr, size), arr);
- max_sort(arr+1, size-1);
- }
Add Comment
Please, Sign In to add comment