Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void swapNodes(song *a, song *b)
- {
- // swap di utils.h
- swap(a->name, b->name);
- swap(a->artist, b->artist);
- unsigned short int t = a->length;
- a->length = b->length;
- b->length = t;
- }
- void selectionSort(Playlist l)
- {
- song *start = l->head;
- song *temp;
- song *min;
- while (start->next != NULL)
- {
- min = start;
- temp = start->next;
- while (temp != NULL)
- {
- if (cmpItem(min->name, temp->name) > 0)
- min = temp;
- temp = temp->next;
- }
- swapNodes(start, min);
- start = start->next;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement