Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program that stores a series of numbers in a binary tree. then have the

ID: 3650615 • Letter: W

Question

write a program that stores a series of numbers in a binary tree. then have the program insert the values into a queue in ascending order. dequeue the values and display them on the screen to confirm that they were stored in the proper order.

Explanation / Answer

for creating a tree for series of members #include #include #include using namespace std; struct tree {int data; tree *left; tree *right; }; tree *root, *temp1, *temp2; void main() {root = new tree; root->data = 15; root->left=NULL; root->right=NULL; getch(); } for inserting values: void main() { root = new tree; cin>>root->data; root->left=NULL; root->right=NULL; for(int i=1; i>temp1->data; temp1->left = NULL; temp1->right= NULL; temp2 = root; if(temp1->data>root->data) { right_tree(); } else { left_tree(); } } getch(); }