Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <class T>
- void CSortList<T>::swap(Node<T>* previousA, Node<T>* a, Node<T>* previousB, Node<T>* b) {
- if (a == b)
- return;
- if (a->link == b || b->link == a)
- {
- this->xchangeInfo(a, b);
- return;
- }
- if (previousA == nullptr)
- {
- head = b;
- }
- else
- {
- previousA->link = b;
- }
- if (previousB == nullptr)
- {
- head = a;
- }
- else
- {
- previousB->link = a;
- }
- Node<T>* tmp = a->link;
- a->link = b->link;
- b->link = tmp;
- while (tail->link != nullptr)
- {
- tail = tail->link;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement