Advertisement
a53

FLdiAdInainte

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