Question: USING C PROGRAMMING: Implementation Requirements Your VS project must include the following files: bst.h bst.c io.h io.c proj2.c 1. bst.h and bst.c should represent the

USING C PROGRAMMING:

Implementation Requirements Your VS project must include the following files:

bst.h

bst.c

io.h

io.c

proj2.c

1. bst.h and bst.c should represent the dynamic binary search tree.

1.1. You should use a struct to represent a node in the tree. This struct should contain the key for that node (type int), and references to its left and right subtrees (struct *).

1.2. You must also include functions for inserting new nodes, searching for a key in the tree, printing an inorder traversal of the tree content (All keys), and

1.3. releasing the memory for all nodes in the tree when the program finishes

1.4. Each of these functions must be recursive.

1.5. All user defined data types and functions related to the binary tree should be declared in the bst.h file and the function implementations in the bst.c file.

2. Suggestion: In the inorder traversal, you may want to use the sprintf function (look for the equivalent function in VS) to convert an int to a string. This function works just like printf, but you print to a string instead of to the console. For example: int num = 4; char buff[10]; sprintf(buff, %d, num); This will print the value in num to the string buff, so that buff holds the string 4. sprintf is in the stdio library.

3. io.h and io.c should handle all input and output.

3.1. You should have a separate option for each type function, (insert, search, inorder, etc.)

3.2. There should be no input and output functions anywhere else in the program. (for example, you cannot print/display the nodes' key inside the inorder function)

3.3. Finally, your prompts and output format should exactly match the example above.

4. proj2.c should contain a single main function.

4.1. It should include bst.h and io.h

4.2. It should call back and forth between bst functions and io functions to get the desired functionality. Additionally,

4.3. if the user inputs an invalid command, you should ignore it and give another prompt.

4.4. When the user selects quit, you should release all the memory allocated for the tree

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!