C programming
Create a BST with following values :{5.5,9.88,3.15,4.7,10.5}
find the two maximum values in the tree
Find the two minimum values in the tree
//For any queries, feel free to comment.
**CODE START**
#include <stdio.h>
#include <stdlib.h>
float arr[100];
int cnt;
struct btnode{
float value;
struct btnode *l;
struct btnode *r;
}*root = NULL, *temp = NULL, *t2, *t1;
//Creating a new node
void create(float data)
{
temp = (struct btnode *)malloc(1*sizeof(struct
btnode));
temp->value = data;
temp->l = temp->r = NULL;
}
//Function to search the appropriate position to insert the new
node
void search(struct btnode *t){
//value more than root node value insert at
right
if ((temp->value > t->value) &&
(t->r != NULL))
search(t->r);
else if ((temp->value > t->value)
&& (t->r == NULL))
t->r = temp;
//value less than root node value insert at
left
else if ((temp->value < t->value)
&& (t->l != NULL))
search(t->l);
else if ((temp->value < t->value)
&& (t->l == NULL))
t->l = temp;
}
/* To insert a node in the tree */
void insert(float data){
create(data);
if (root == NULL)
root = temp;
else
search(root);
}
//Function to perform inorder traversal of tree
void inorder(struct btnode *t){
if (t->l != NULL)
inorder(t->l);
//Storing inorder traversal in an array
"arr"
arr[cnt++] = t->value;
if (t->r != NULL)
inorder(t->r);
}
void main()
{
//Inserting all those 5 values
insert(5.5);
insert(9.88);
insert(3.15);
insert(4.7);
insert(10.5);
//Inorder will provide elements in sorted
order
inorder(root);
//Last two values will be Maximum
printf("Maximum two values are %f and
%f\n",arr[cnt-1],arr[cnt-2]);
//First two values will be Minimum
printf("Minimum two values are %f and
%f\n",arr[0],arr[1]);
}
**CODE END**


**OUTPUT

**SNIPPET END**
C programming Create a BST with following values :{5.5,9.88,3.15,4.7,10.5} find the two maximum values in the...
help
2. Do the following problems: Create a binary search tree (BST), with the following words inserted: Int, Char, Return, Break, Float, While, Short, Sort, Double, For, Continue. a. b. Insert the following words into the BST built in (a): Tree, Table, Binary, Network, Visit, Seekk, Traversal c. Where is the minimum key value in a BST? (Give a concrete example) d. Where is the maximum key value in a BST? (Give a concrete example) e. How many comparisons are...
Java: Create a BST with input keys S E X R A C. (Assume the values are 1,2,3,4,5,6, resp.)
Programming in C++ Implement a BST (Binary Search Tree) and test your program. (Linked List based.) You should test at least the three major functions. (Insert, Retrieve, and Delete).
Using C Please comment
Part 1: BST Create a link based Binary Search tree composed of a Node and a Tree struct. You should have a header file, BST.h, with the following: o Node struct containing left, right, and parent pointers, in addition to holding an Data struct value Tree struct containing a pointer to the root of the tree A function declaration for a function that allocates a tree, and initializes the root to NULL o o o A...
Hello, I need help implementing the c++ code for successor and
predecessor of a BST following the pseudocode below, thank you for
your help in advance.
struct treeNode
{
int data;
treeNode *left;
treeNode *right;
};
treeNode* FindMin(treeNode *node) /* find the minumum node
*/
{
while (node->left != NULL)
{
node = node->left;
}
return node;
}
treeNode* FindMax(treeNode *node) /* find the maximum node
*/
{
while (node->left != NULL)
{
node = node->right;
}
return node;
}...
11. Given the following constraints, find the minimum and maximum values of C = 5x + 3y. x+y S5 Xeyss 2x + y S8 2x+y=8 x 20, 20 Minimum Value Maximum Value
Construct a Binary Search Tree (BST) program in C++. The program is required to: 1) load the BST from a dataset (I will provide the datasets-see below) in the order they exist in the dataset. 2) after the BST is built analyze the BST and display the following values: 2.1) the smallest branch height 2.2) the highest branch height 2.3) the number of nodes in the tree 2.4) the determination if the tree is balanced 2.5) the determination if the...
Write a program in C fro Binary Search tree using following functions 1. Insertion operation using recursion 2. Deletion operation 3. Minimum/Maximum of a BST 6. Reorganize the tree so that the tree height is minimum 7. Print all the nodes from the node to the path to the root 8. Find the lowest common shared node between two given nodes
Find the minimum and maximum values of the function
Find the maximum and minimum values of the function g(0) = 60 – 8 sin(0) on the interval (0,7) Minimum value = Preview Maximum value = Preview
Create a new Java Application that has the following methods: A method that generate a binary search tree (BST) where the number of nodes and the range of the values are from a file. A recursive method to print the BST in preorder traversal A recursive method to print the BST in post-order traversal A recursive method to print the BST in in-order traversal A recursive method to count the number of all nodes in BST A method to find...