Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I'm receiving three errors on c++ code>. How do I fix? error: variable or field '_print_tree' declared void 33 | void _print_tree(Node *current) { error:

I'm receiving three errors on c++ code>. How do I fix?

error: variable or field '_print_tree' declared void

33 | void _print_tree(Node *current) {

error: 'Node' was not declared in this scope

33 | void _print_tree(Node *current) {

error: 'current' was not declared in this scope

33 | void _print_tree(Node *current) {

-------------------------------------------------------------------------------------

#include

using namespace std;

int nodeLevel(int value) {

if (root == NULL) {

return -1;

} else {

return _nodeLevel(value, root, 0);

}

}

int _nodeLevel(int value, Node *current, int level) {

if (current == NULL) {

return -1;

} else if (value == current->data) {

return level;

} else if (value < current->data) {

return _nodeLevel(value, current->left, level+1);

} else {

return _nodeLevel(value, current->right, level+1);

}

}

def print_tree() {

if (root == NULL) {

return;

} else {

_print_tree(root);

}

}

void _print_tree(Node *current) {

if (current == NULL) {

return;

} else {

_print_tree(current->left);

cout << current->data << endl;

_print_tree(current->right);

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Write an elaborate note on marketing environment.

Answered: 1 week ago

Question

Design a job advertisement.

Answered: 1 week ago