Advertisement
Guest User

Kocham Cię, Pączusiu

a guest
Jan 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. int Bliskie(drzewo *d, int *x)
  2. {
  3. int l, p;
  4. if(d == NULL)
  5. {
  6. *x = MAX_INT;
  7. return -1;
  8. }
  9. int wl,wp;
  10. int l = Bliskie(d->lsyn,&wl);
  11. int p = Bliskie(d->psyn,&wp);
  12. if(l == -1){
  13. *x = wp;
  14. return p+1;
  15. }
  16. if(p == -1){
  17. *x = wl;
  18. return l+1;
  19. }
  20. *x = min(wl,wp,l+p+2);
  21. return min(l,p)+1;
  22. }
  23.  
  24. int BliskieLiscie(drzewo *d){
  25. int x;
  26. Bliskie(d, &x);
  27. if(x == MAX_INT)return 0;
  28. return x;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement