Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node* poprzednik(node* root, node*& pop, int x)
- {
- if (root == NULL)
- {
- pop = NULL;
- return NULL;
- }
- if (x == root->val)
- {
- if (root->l)
- {
- pop = max(root->l);
- }
- }
- else if (x < root->val)
- {
- poprzednik(root->l, pop, x);
- }
- else
- {
- pop = root;
- poprzednik(root->r, pop, x);
- }
- return pop;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement