Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

image text in transcribed
image text in transcribed
(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Systems A 360-degree Approach

Authors: Jawwad ShamsiMuhammad Khojaye

1st Edition

0429531575, 9780429531576

Students also viewed these Databases questions