Advertisement
mihaimarcel21

InserareInainteQ

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