Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int Bliskie(drzewo *d, int *x)
- {
- int l, p;
- if(d == NULL)
- {
- *x = MAX_INT;
- return -1;
- }
- int wl,wp;
- int l = Bliskie(d->lsyn,&wl);
- int p = Bliskie(d->psyn,&wp);
- if(l == -1){
- *x = wp;
- return p+1;
- }
- if(p == -1){
- *x = wl;
- return l+1;
- }
- *x = min(wl,wp,l+p+2);
- return min(l,p)+1;
- }
- int BliskieLiscie(drzewo *d){
- int x;
- Bliskie(d, &x);
- if(x == MAX_INT)return 0;
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement