Question: 1.6 Bst: Binary Search Trees Write A Program Bst That Manipulates Binary Search Trees. It Will Receive Commands From Standard Input, And Print Resposes To
1.6 Bst: Binary Search Trees Write A Program Bst That Manipulates Binary Search Trees. It Will Receive Commands From Standard Input, And Print Resposes To Those Commands To Standard Output. A Binary Search Tree Is A Binary Tree That Stores Integer Values In Its Interior Nodes. The Value For A Particular Node Is Greater Than Every Value Stored Its Left
In C




1.6 bst: Binary search trees Write a program bst that manipulates binary search trees. It will receive commands from standard input, and print resposes to those commands to standard output. A binary search tree is a binary tree that stores integer values in its interior nodes. The value for a particular node is greater than every value stored its left sub-tree and less than every value stored in its right sub-tree. The tree will not contain any value more than once. bst will need to allocate space for new nodes as they are created using malloc; any allocated space should be deallocated using free before bst terminates. This portion of the assignment has two parts. Part 1 In this part, you will implement bst with three commands: insert n Adds a value to the tree, if not already present. The new node will always be added as the child of an existing node, or as the root. No existing node will change or move as as result of inserting an item. If n was not present, and hence has been inserted, bst will print inserted. Otherwise, it will print not inserted. The instruction format is an i followed by a decimal integer n. 5 search n Searches the tree for a value n. If n is present, bat will print present. Otherwise, it will print absent. The instruction format is an a followed by a space and an integer n. print Prints the current tree structure, using the format in section [1.6.1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
