Advertisement
a53

InserareDupaQ

a53
Jun 16th, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. void InserareDupaQ(nod *& prim, nod *& ultim, nod*q,int x)
  2. {
  3.  
  4. if(q==ultim)
  5. {
  6. nod*p=new nod;
  7. p->info=x;
  8. p->pre=NULL;
  9. p->ant=ultim;
  10. ultim->pre=p;
  11. ultim=p;
  12. }
  13. else
  14. {
  15. nod*p=new nod;
  16. p->info=x;
  17. p->pre=q->pre;///1
  18. p->ant=q;///2
  19. q->pre=p;///3
  20. q->pre->ant=p;///4
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement