Question: these are the data texts which are using in this code; 4 data txt file data1.txt 20 8 22 4 12 10 14 data2.txt 127,

 these are the data texts which are using in this code;

these are the data texts which are using in this code; 4 data txt file

data1.txt

20 8 22 4 12 10 14

data2.txt

127, 234, 127, 654, 355, 789, 355, 355, 999, 654

data3.txt

44 31 83 95 18 100 22 58 36 54 24 58 98 95 94 27 53 86 56 71 34 71 88 19 26 46 53 89 72 57 37 34 61 75 25 34 19 55 100 30 70 32 41 26 79 52 75 9 4 39 67 91 71 5 19 39 4 98 61 39 42 96 3 8 63 74 84 95 28 62 54 62 61 1 5 6 33 58 83 67 98 63 76 91 83 68 64 14 80 7 33 2 67

data4.txt

0.815 0.906 0.127 0.913 0.632 0.098 0.278 0.547 0.958 0.965 0.158 0.971 0.957 0.485 0.800 0.142 0.422 0.916 0.792 0.959 0.656 0.036 0.849 0.934 0.679 0.758 0.743 0.392 0.655 0.171 0.706 0.032 0.277 0.046 0.097 0.823 0.695 0.317 0.950 0.034 0.439 0.382 0.766 0.795 0.187 0.490 0.446 0.646 0.709 0.755

the following: - The left subtree nodes less than the node's key, i.e., (the root). - The right subtree nodes greater than the node's key, i.e., (the root). - The left and right subtree each must also be a BST. Unlike linear data structures (Array, Linked List, Queues, Stacks, etc) which have only one logical way to traverse them, trees can be traversed in different ways. Here is a list of depth first traversal methods: (a) Inorder (Left, Root, Right):, (b) Preorder (Root, Left, Right), Postorder (Left, Right, Root). Write a C program that you implement BST representation using data provided in an input text file using the command line arguments. Check the provided BST node structure. Your program should read input file to form a BST, display BST nodes in Inorder and return kth largest element(s) in the BST. You should run your code as follows: ./q1 data1.txt 5 ./q1 data1.txt 5811 (a) [10 Points] Write a C function(s) to read input data (unsorted) from an input data file to form a BST. Note that data can be assumed as 'double' type but the number of entries in each file is unknown, and hence to be read dynamically until EOF (End of File) is reached. (b) [10 Points] Write a C function display the elements using inorder traversal method, i.e., in sorted order from minimum to maximum value (no duplicates). (c) [15 Points] Write a C function to find the kth largest element in the BST, where k is also a variable to be read using command line arguments. Here is an algorithm. [-] Find the reverse of inorder traversal of the binary search tree. [-] Keep track of the count of nodes visited while traversing. [-] When the count of the nodes becomes equal to k value, return the node. (c) [5 Points] Complete the main() to process command line arguments, and print the outcomes as in sample runs, (make sure to match the format of your outputs with

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!