AfanasevGad7

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

commit 21705f93b6b23825b418fa76794b739c74c5b0f2
parent 4003f8e85f2644c805c7323ca5e54ef076465931
Author: Plat <plat@stellar-nexus.ru>
Date:   Tue, 21 Oct 2025 17:53:07 +0000

Fixed names to root

Diffstat:
Mparser.c | 20++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/parser.c b/parser.c @@ -19,13 +19,13 @@ void add(int val, Node *root) { if (val < root->val) { - if (n->left == NULL) - n->left = init(val); + if (root->left == NULL) + root->left = init(val); else add(val, root->left); } else { - if (n->right == NULL) - n->right = init(val); + if (root->right == NULL) + root->right = init(val); else add(val, root->right); } @@ -41,11 +41,11 @@ parse_pre(unsigned int *index, Node *root) return root; --(*index) - Node *res = parse_pre(node->left, index); + Node *res = parse_pre(root->left, index); if (res) return res; - return parse_pre(node->right, index); + return parse_pre(root->right, index); } Node* @@ -54,10 +54,10 @@ parse_post(unsigned int *index, Node *root) if (!root) return NULL; - Node *res = parse_post(node->left, index); + Node *res = parse_post(root->left, index); if (res) return res; - *res = parse_post(node->right, index); + *res = parse_post(root->right, index); if (res) return res; @@ -74,7 +74,7 @@ parse_inf(unsigned int *index, Node *root) if (!root) return NULL; - Node *res = parse_inf(node->left, index); + Node *res = parse_inf(root->left, index); if (res) return res; @@ -82,5 +82,5 @@ parse_inf(unsigned int *index, Node *root) return root; --(*index) - return parse_inf(node->right, index); + return parse_inf(root->right, index); }