Question: (a) (5 pts.] Complete the pseudocode for the SPLAY method, corresponding to the proper splay operation in a splay tree, and started for you in

(a) (5 pts.] Complete the pseudocode for the SPLAY method, corresponding to the proper splay operation in a splay tree, and started for you in the partial pseudocode given in Algorithm 4, by matching the missing statements (in line indexes 3, 5, 7, 9, and 11) with the corresponding method call for the appropriate restructure operation. Algorithm 4 SPLAY(T2) 1: if r = NULL then return 2: while r.parent #NULL do if y.parent = NULL then else if (y.left = 1) = (z.left = y) then else 12: T.root + Statement # Restructure Operation Statement 3 2+ y.parent Statement 5 ZIG(x, y) Statement 7 ZIGZAG(x, y, z) Statement 9 y x.parent Statement 11 ZIGZIG(2, 4, ) (b) (2 pts. Build the pseudocode of the ZIGZAG method, corresponding to the proper zig-zig restructure operation in a splay tree, in Algorithm 5, by matching the missing statements in line indexes 1 and 2) with the corresponding operation. Algorithm 5 ZIGZAG(x, y, z) Statement # Operation Statement 1 SINGLEROTATION, 2) Statement 2 SINGLEROTATION, y) (c) (2 pts. Provide a tight big-Oh expressions for the worst-case running time and space complexity of Algorithm 4 as a function of the number of entries n in the splay tree T of which is the node be splayed. (Assume that the substep splay operations have been properly implemented.) Time Space
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
