SHARE
TWEET

hahahahaha

a guest Oct 14th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void sort()
  2.     {
  3.         std::vector<LinkedList<Student>::Node*> temp;
  4.  
  5.         for (auto node = m_pHead; node; node = node->next)
  6.         {
  7.             temp.emplace_back(node);
  8.         }
  9.  
  10.         std::sort(temp.begin(), temp.end(),
  11.             [](const LinkedList<Student>::Node* a, const LinkedList<Student>::Node* b)
  12.             {
  13.                 return atoi(a->val.ID) < atoi(b->val.ID);
  14.             });
  15.  
  16.         int n = temp.size();
  17.         for (int i = 0; i < n - 1; ++i)
  18.         {
  19.             temp[i]->next = temp[i + 1];
  20.         }
  21.  
  22.         m_pHead = temp[0];
  23.         temp[n - 1]->next = nullptr;
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top