Question
#include using namespace std; struct Node { int small; int large; Node * left; Node* middle; Node* right; }; void inOrder(Node*); int main() { Node
#include
struct Node { int small; int large; Node * left; Node* middle; Node* right; };
void inOrder(Node*);
int main() { Node root; Node n2; Node n3; Node n4; Node n5; Node n6; Node n7; Node n8; Node n9; Node n10; Node n11;
root.small = 50; root.large = 90; root.left = &n2; root.right = &n4; root.middle = &n3;
n2.small = 20; n2.left = &n5; n2.right = &n6;
n3.small = 5; n3.left = &n7; n3.right = &n8;
n4.small = 120; n4.large = 150; n4.left = &n9; n4.middle = &n10; n4.right = &n11;
n5.small = 10; n5.left = NULL; n5.right = NULL;
n6.small = 30; n6.large = 40; n6.left = NULL; n6.right = NULL;
n7.small = 60; n7.left = NULL; n7.right = NULL;
n8.small = 80; n8.left = NULL; n8.right = NULL;
n9.small = 100; n9.large = 110; n9.left = NULL; n9.right = NULL;
n10.small = 130; n10.large = 140; n10.left = NULL; n10.right = NULL;
n11.large = 160; n11.left = NULL; n11.right = NULL;
inOrder(&root);
system("pause"); return 0; }
void inOrder(Node *root) { if (root != NULL) { inOrder(root->left); cout small middle large right); } }
Its not working at all this is my output.
2-3- Trees: Create the 2-3 tree with 11 nodes (figure 1) by using class representation. Also, implement in-order traversal, and print the results struct Node int small; int large; Node left Node middle Node* rightStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started