Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I want to write a java program that implements node insert,delete and search method on Splay trees using 1-Main.java, 2-SplayTree.java, 3-Node.java I must implement following
I want to write a java program that implements node insert,delete and search method on Splay trees using 1-Main.java, 2-SplayTree.java, 3-Node.java I must implement following methods in SplayTree.java: 1. public void add(int value)+add value data to Splay Tree. 2. public void leftChildMakeParent (Nodec, Node p)+performs right rotation 3.public void rightChildMakeParent(Node C, Node p)+performs left rotation 4.public void Splay(Node x)performs splay operation using leftChild MakeParent and rightChild MakeParent. 5.public void delete(Node selectnode)remove selectnode from Splay Tree. 6.public Node search(int value)+find a node that has an value data. NOTE 1- After each operation that's executed, you must print the level order of the tree. 2- In case any internal node does not have a left or right child element, you ought to print a hyphen instep. INPUT OUTPUT add 1 1 add 2 2,1,- delete 2 1 add 5 5,1, - delete 1 5 search 5 5 add 19 19,5,- search 15 5, -, 19 add 12 12, 5, 19 delete 3 5, -, 12, -, -, -, 19
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started