$30
This project is a programming assignment in C which aims to write an algorithm that will build a ternary search tree (TST) and makes necessary operations in this tree.
a) Consider a TST where the only difference with a binary search tree is that a key that is greater than the current node’s key but less than or equal to the square of it is located at the middle child of the node. More formally expressed,
Key(LCA) < Key(A) < Key(MCA) ≤ (Key(A))2 < Key(RCA)
where A represents the current node, LCA, MCA and RCA denote the left child, the middle child and the right child of A, in respective order.
Write a recursive insert function that inserts a list of keys given you as an input file in the above TST!
Hint: Both the node structure and the function should be very similar to that of the binary search tree in your lecture notes.
b) ) Write a remove function that searches for a given key in the above TST given in (a) and remove it and finally re-build the TST!
c) Write a recursive find function that searches for a given key in the above TST given in (a)!
d) In (a), (b) and (c) parts the formula is given and you are expected to do the necessary operations. This time, find a formula that makes the tree has a minimum depth level. Before starting implementation, studying mathematical proof of this question will be useful for you. After you decide the formula, implement the (a), (b) and (c) parts.