AfanasevGad7

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

commit 4c9a7561e937e85d6408e5242f4330681efae48e
parent 30c56b9b54b86fc38e233fb8cfef083491b7804b
Author: Plat <plat@stellar-nexus.ru>
Date:   Thu, 23 Oct 2025 19:16:50 +0000

Fixed segfaults on turns

Diffstat:
Mfinal_solution.cpp | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/final_solution.cpp b/final_solution.cpp @@ -145,6 +145,9 @@ get_height(Node* root) Node* right_turn(Node* root) { + if (!root || !root->right) + return root; + Node* buf = root->right; if (!buf || !root) return NULL; @@ -159,6 +162,9 @@ right_turn(Node* root) Node* left_turn(Node* root) { + if (!root || !root->left) + return root; + Node* buf = root->left; if (!buf || !root) return NULL;