Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Node* addNodeRecursive(Node* root, const int value) {
- if (root)
- {
- if (value < root->value)
- {
- root->left = addNodeRecursive(root->left, value);
- }
- else if (value > root->value)
- {
- root->right = addNodeRecursive(root->right, value);
- }
- else
- {
- throw string{ "Uzol uz bol pridany" };
- }
- return new Node{ value,nullptr,nullptr };
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement