Skip to content

Instantly share code, notes, and snippets.

@arruda
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arruda/9175019 to your computer and use it in GitHub Desktop.
Save arruda/9175019 to your computer and use it in GitHub Desktop.
void InserctionSort(int n, int vetor[]){
int j,i, chave;
for(j = 1; j < n; j++){
chave = vetor[j];
i = j - 1;
while(i >= 0 && vetor[i] > chave){
vetor[i + 1] = vetor[i];
i = i - 1;
}
vetor[i + 1] = chave;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment