AfanasevGad7

This is a task for our favourite professor
git clone git://git.stellar-nexus.ru/AfanasevGad7
Log | Files | Refs

commit 341d82268bcae314ccf5a11b6523acc4371a199b
parent 2602cce5637a32ada794fbca2f9b884899c98531
Author: = <=>
Date:   Thu, 23 Oct 2025 17:12:42 +0300

Real final cpp solution added

Diffstat:
A.gitignore | 2++
Mfinal_solution.cpp | 21++++++++++++++++++---
2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1 @@ +/.vscode/ +\ No newline at end of file diff --git a/final_solution.cpp b/final_solution.cpp @@ -26,6 +26,8 @@ Node* left_turn(Node*); Node* right_turn(Node*); +Node* search(Node*, int); + int main() { @@ -37,8 +39,11 @@ int main() { std::cin >> k; add(k, root); root = balance(root); - } + + // value_node = search(root, 'int value from input')); + + return 0; } @@ -171,4 +176,15 @@ balance(Node* root) } return root; -} -\ No newline at end of file +} + + +Node* +search(Node* root, int val) +{ + if (root->val == val) return root; + + if (root->val > val) return search(root->left, val); + + return search(root->right, val); +}