Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void shellsort(unsigned *vetor, unsigned quantidade)
- {
- int j, indice = quantidade;
- unsigned i, aux;
- while( indice > 0 )
- {
- indice /= 2; /* atualiza o indice */
- for( i = indice; i < quantidade; i++ )
- {
- aux = vetor[i];
- j = i;
- /* Compara os valores, baseado na distancia indice */
- while( vetor[j - indice] > aux && j - indice >= 0 )
- {
- vetor[j] = vetor[j - indice];
- j -= indice;
- }
- vetor[j] = aux;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment