Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. struct Node
  2. {
  3. struct Node *prev,*next;//ssilki
  4. char *elem; //str
  5. };
  6.  
  7. struct List
  8. {
  9. struct Node *first,*last;// ssilkui
  10. };
  11.  
  12. void process(List lst, string str){
  13. Node *cur,*nextc,*prevc;
  14.  
  15. cur=lst.first;
  16. nextc=cur->next;
  17. prevc=cur->prev;
  18.  
  19. while(cur!=lst.last){
  20. if(str == cur->elem){
  21. nextc->prev=cur->prev;
  22. prevc->next=cur->next;
  23. delete cur;
  24. }
  25. else if(cur->elem > str){
  26. lst.last->next=prevc->next;
  27. nextc->prev=cur->prev;
  28. prevc->next=cur->next;
  29. cur->prev=lst.last->prev->next;
  30. }
  31. }
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement