Question
We have three classes; RUN ST(can be described as a splayt) N(can be described as a node) In ST class involves, void add(int v)--->add variable
We have three classes;
RUN
ST(can be described as a splayt)
N(can be described as a node)
In ST class involves,
void add(int v)--->add variable to ST
void leftchildparent(N c,N p)--->do right rotatate
void rightchildparent(N c,N p)--->do left rotatate
splay(Node v)---> it will use leftchildparent and rightchilparent for performing splaytree
remove(Node v)--remove node from splay
findNode(int v)---find node
//driver code input(it has to be dynamic)
insert 1
insert 2
remove 2
insert 5
remove 1
find 5
insert 19
find 15
insert 12
1
remove 3
After each operation executed, you must print level order traversal of tree. If there is no left or right
child element of any internal node, you should print a hyphen instead. For above input file, the output
must be like below:
1
2 1 -
1
5 1 -
5
5
19 5 -
5 - 19
12 5 19
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