Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!