Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Skip Lists Here is a skip list, including instance variables s (the starting position), h (the height: we assume that h starts counting from 0),

Skip Lists

Here is a skip list, including instance variables s (the starting position), h (the height: we assume that h starts counting from 0), and n (the number of keys currently stored in the skip list). For simplicity, the graphic shows only horizontal lines, but keep in mind that these are doubly linked lists in both the horizontal and vertical directions. You can use this simplified drawing in your response.

image text in transcribed

(a) Trace the path that SkipSearch(23) takes, by circling every node that p is assigned to as the SkipSearch algorithm executes, starting with s.

In the remaining questions, you will show what the skip list shown above looks like after the cumulative operations indicated below, using the pseudocode for SkipInsert and SkipSearch. Trace the algorithm using the sequence of random numbers, [0,1], where the insertion code says while random(0,1) 1/2 do (Not all of the numbers will be used). The operations are cumulative: each step builds on the result of the previous one. Redraw the entire data structure after each operation, and also update instance variables s, h and n as needed.

SkipInsert algorithm:

image text in transcribed

SkipSeach algorithm:

image text in transcribed

(b) Redraw after SkipInsert(53,data) where random(0,1) returns 0.11, 0.47, 0.23, 0.88, 0.04, ...

(c) Redraw after SkipInsert(32,data) where random(0,1) returns 0.37, 0.61, 0.13, 0.94, 0.28,

(d) Redraw after SkipDeletePosition(SkipSearch(15)).

h-3, n=4 S3 -inf +inf 15 S2 -in S1-inf SO -inf +inf 23inf 10 15 23 36 +inf h-3, n=4 S3 -inf +inf 15 S2 -in S1-inf SO -inf +inf 23inf 10 15 23 36 +inf

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

Step: 3

blur-text-image

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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

State the rationale for a team approach.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago