### CS323 - Homework on Splay and 2,4-trees

• Splay tree (20 pts)

• Consider the following Splaytree:

Questions:

• Compute the balance of rotation operation r(T) stored in the tree (5 pts)

• Perform a splay operation on the node 80:

 Show the Splaytree after one elementary (zig-zig/zig-zag) operation (5 pts) Show the Splaytree after the splay operation has completed (5 pts)

• Compute the balance of rotation operation r(T') stored in the resulting tree (= the tree after the splay operation has completed) (5 pts)

• Insert in 2,4-tree (30 pts)

• Consider the following 2,4-tree:

Question 1: (10 pts)

 Show the 2,4-tree after inserting the entry with key = 5 into the tree above, ignoring overflow (I want to see where you insert this entry) -- 2 pts Show the 2,4-tree after fixing the overflow -- 8 pts

Question 2: (20 pts)

 Start with the original 2,4-tree shown in the above figure. Give the (2,4) tree after inserting 46 into the tree, ignoring overflow - 2 pts Give the (2,4) tree after fixing the initial overflow (8 pts) Give each (2,4)trees trees after fixing each additional overflow. (10 pts)

• Delete in 2,4-tree

• Consider the same 2,4-tree:

Questions:

• Show the tree after delete(30) (5 pts)

• Using the original tree, we now perform delete(53):

 Show the resulting tree if the underflow is resolved with a transfer operation with its left immediate sibling node (10 pts) Show the resulting tree if the underflow is resolved with a merge operation with its right immediate sibling node (10 pts)

• Using the original tree, we now perform delete(20):

 Give the (2,4)-tree after deleting 20, ignoring any underflow (5 pts) Give the (2,4)-tree after fixing the initial underflow (10 pts) Give each of the (2,4)-tree s after fixing each additional underflow (10 pts)