Advertisement
mihaimarcel21

FInserareDupaQ

Apr 20th, 2021
450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 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