boolean search(E key, NodeThe function returns true or false to indicate if key has been found in the tree. If key has been found, the reference current will point to the node containing key; otherwise, current will be null. If key has been found and current has a parent, then the reference parent will point to that parent. If key has not been found and the tree is non-empty, then parent will point to the node who would be the parent of the node containing key, if key were to be inserted now. In all other cases, parent should be null.current, Node parent)
void rightRotation(Node <E> localRoot) void leftRotation(Node <E> localRoot)
Implement a class called rotateToTopTree which implements the data structure described above. The rotateToTopTree class is like the tree class, except that the find method behaves a bit differently. When this method finds a node x with the given key, it rotates x to the top; if find does not find a node with the given key, it takes the node y that was the last node in the search path and rotates y to the top.
root = 100, left child of 100 = 80, right child of 100 = 120 left child of 80 = null, right child of 80 = 90 left child of 120 = null, right child of 120 = null left child of 90 = 85, right child of 90 = null left child of 85 = null, right child of 85 = nullPerform a left rotation at 80. Show the resulting tree. Is it balanced? Explain your answer.