SHARE
TWEET

Untitled

a guest Nov 19th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void SortedDLList::del(int x)
  2. {
  3.     Elem* p = locate(x);
  4.     if (p == NULL) //elementu nie ma w liscie lub lista jest pusta
  5.     {
  6.         return;
  7.     }
  8.     else if (p == head) //poszukiwany element jest head
  9.     {
  10.         head = head->next();
  11.         delete p;
  12.         list_size--;
  13.     }
  14.     else if (p != tail) //poszukiwany element jest pomiedzy head a tail
  15.     {
  16.         p->prev()->setNext(p->next());
  17.         p->next()->setPrev(p->prev());
  18.         delete p;
  19.         list_size--;
  20.     }
  21.     else //poszukiwany element jest tail
  22.     {
  23.         tail = tail->prev();
  24.         delete p;
  25.         list_size--;
  26.     }
  27. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top