Reverse Sort
Lição 8 de 11 do curso Bubble Sort da Coddy.
Desafio
FácilCrie uma função chamada reverse_sort que recebe um array e o tamanho do array. Ordene o array em ordem reversa usando o algoritmo bubble sort. Retorne o array final.
Por exemplo,
Entrada Fornecida: [2,4,1,2,3]
n=5
Saída: [4,3,2,2,1]
Experimente você mesmo
#include <stdio.h>
#include <stdlib.h>
int* reverse_sort(int* arr, int arr_size, int n, int* returnSize) {
// Escreva o código aqui
*returnSize = n;
return arr;
}
Todas as lições de Bubble Sort
1Basics of Bubble Sort
IntroductionWorking of the Bubble SortSwap adjacent elementsBubble Sort Algorithm