SHARE
TWEET

brsnje

a guest Oct 22nd, 2019 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Obrisi_stablo(Cvor* koren, Cvor** stek, int *top)
  2. {
  3.     Cvor* pom;
  4.  
  5.     stek_push(stek, koren, top);
  6.  
  7.     while(top != 0)
  8.     {
  9.         koren = stek_pop(stek, top);
  10.         pom = koren;
  11.         free(koren);
  12.  
  13.         if(pom->desno != NULL)
  14.            stek_push(stek, koren->desno, top);
  15.  
  16.          if(pom->levo)
  17.            stek_push(stek, koren->levo, top);
  18.  
  19.     }
  20.  
  21.     printf("Stablo je obrisano!\n");
  22. }
  23.  
  24. Cvor* stek_pop(Cvor** stack, int * top)
  25. {
  26.     return stack[(*top)--];
  27. }
  28.  
  29. void stek_push(Cvor** stack, Cvor* cvor, int* top)
  30. {
  31.     stack[++(*top)] = cvor;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top