Started late on this and could use some help! Basically I need a program that is
ID: 653823 • Letter: S
Question
Started late on this and could use some help! Basically I need a program that is able to carry out these specific tasks in C, thank you!
Define a binary search tree node to include
struct binTreeNode
{
int data;
struct binTreeNode * right;
struct binTreeNode * left;
};
main()
- Provide the user a menu of the following options:
1. Generate Binary Search Tree
2. Print the BST in pre-order format
3. Print the BST in in-order format
4. Print the BST in post-order format
5. Print the BST in breadth-first format
6. Find a value in the BST
7. Find the minimum value in the BST nodes
8. Find the maximum value in the BST nodes
9. Calculate the average value of the BST nodes
10. Find the median value of the BST nodes
11. Calculate the sum of the BST nodes
12. Count the number of BST nodes
13. Delete a value in the BST
14. Exit Program
- Use a conditional statement to evaluate the user
Define a binary search tree node to include
struct binTreeNode
{
int data;
struct binTreeNode * right;
struct binTreeNode * left;
};
Explanation / Answer
#include<stdio.h>
#include<conio.h>
int menu()
{
int c;
clrscr();
printf("Main Menu");
printf(" 1. Generate Binary Search Tree");
printf(" 2. Print BST in pre-order format");
printf(" 3. Print BST in in-order format");
printf(" 4. Print BST in post-order format");
printf(" 5. Priint BST in breadth-first format");
printf(" 6. Find the value in BST");
printf(" 7. Find the minimum value in the BST node");
printf(" 8. Find the maximum value in the BST nodes");
printf(" 9. Calculate the avegarge value of the BST nodes");
printf(" 10. Find the median value of the BST node");
printf(" 11. Calculate the sum of BST nodes");
printf(" 12. Count the number of BST nodes");
printf(" 13. Delete a value in the BST");
printf(" 14. Exit Program");
printf(" Enter your choice");
scanf("%d",&c);
return c;
}
void main()
{
struct binTreeNode
{
int data;
struct binTreeNode *right;
struct binTreeNode *left;
};
struct binTreeNode newnode;
int ch=menu();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.