Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- noLista* insertionSort(noLista *ini, int tam){
- int num;
- noLista *aux;
- noLista *aux2;
- aux = ini-> prox;
- char nomeA[30];
- while (aux != NULL){
- num = aux->nota;
- strcpy(nomeA ,aux->nome);
- aux2 = aux->ant;
- while(aux2 != NULL && aux2->nota > num){
- aux2->prox->nota = aux2->nota;
- strcpy(aux2->prox->nome, aux2->nome);
- strcpy(aux2->nome, nomeA);
- aux2 = aux2->ant;
- }
- if (aux2 == NULL){
- ini->nota = num;
- strcpy(ini->nome, nomeA);
- }else{
- aux2->prox->nota = num;
- strcpy(nomeA, aux2->prox->nome);
- }
- aux = aux->prox;
- }
- return ini;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement