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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!