Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <cstdlib>
- struct cvor
- {
- int val;
- cvor *l, *r;
- } *root;
- void umetni (cvor **root, cvor *x)
- {
- if (*root==NULL)
- {
- *root=x;
- x->l=NULL;
- x->r=NULL;
- }
- else if (x->val < (*root)->val) umetni(&(*root)->l, x);
- else umetni(&(*root)->r, x);
- }
- int main()
- {
- int x;
- while (scanf ("%d", &x));
- {
- int x;
- scanf ("%d", &x);
- cvor *novi=(cvor *)malloc(sizeof (cvor));
- novi->val=x;
- umetni (&root, novi);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement