Advertisement
codisinmyvines

SortList

Oct 8th, 2020
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. void UporList::Sort()
  2. {
  3.     this->Reset();
  4.     int min;
  5.     node* k = top;
  6.     while (pred->next != 0)
  7.     {
  8.         min = pred->data;
  9.         marker = pred->next;
  10.         while (marker != 0)
  11.         {
  12.             if (marker->data < min)
  13.             {
  14.                 k = marker;
  15.                 min = marker->data;
  16.             }
  17.             marker = marker->next;
  18.         }
  19.         std::swap(pred->data, k->data);
  20.         pred = pred->next;
  21.     }
  22.     this->Reset();
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement