Answer the question
In order to leave comments, you need to log in
How to remake the insertion sort function in descending order?
Good morning.
How can I modify this insertion sort function so that it sorts in descending order?
void insort(int* l, int* r) {
for (int *i = l + 1; i < r; i++) {
int* j = i;
while (j > l && *(j - 1) > *j) {
swap(*(j - 1), *j);
j--;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question