Write the following Scheme functions in Java repChildren ta
Write the following Scheme functions in Java:
\"repChildren\" - takes in four parameters: - a binary tree T - a key value K - a new left child value L - a new right child value R The input tree is a list of the form (root leftchild rightchild), where the root is an integer, and the left and right children are trees. An empty tree is denoted by the empty list, and leaf nodes are designated with an empty list. The tree is not necessarily ordered. Your function returns a list similar to L, but at each occurrance of K, its children are replaced by L and R. For example: (repChildren \'(7 (3 () ()) (6 (5 () ()) ()))) should return: (7 (3 () ()) (6 (1 () ()) (2 () ()))) Note that the inserted children need to be inserted as nodes, meaning they must be given left and right children that are empty lists (as shown in the above example).
Solution
The BinaryTree class consists of an array of TreeNodes ...
