Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void add(el_bst * drzewo, int n, char c[], char d[])
- {
- el_bst *nowy, *y=NULL, *x=root;
- nowy=malloc(sizeof(el_bst));
- nowy->nrindeksu=n;
- strcpy(nowy->imie,c);
- strcpy(nowy->nazwisko,d);
- nowy->left=nowy->right=NULL;
- while (x)
- {
- y=x;
- x= (nowy->nrindeksu<x->nrindeksu) ? x->left : x->right;
- }
- nowy->p=y;
- if(!y) {root=nowy;}
- else if (nowy->nrindeksu < y->nrindeksu)
- {
- y->left=nowy;
- }
- else y->right=nowy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement