Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you want to perform an experiment to verify the problems that can be caused by random insert / remove pairs. Here is a strategy

Suppose you want to perform an experiment to verify the problems that can be
caused by random insert/remove pairs. Here is a strategy that is not perfectly random, but close enough. You build a tree with N elements by inserting N elements
chosen at random from the range 1 to M =\alpha N. You then perform N2 pairs of insertions followed by deletions. Assume the existence of a routine, randomInteger(a,b),
which returns a uniform random integer between a and b inclusive.
a. Explain how to generate a random integer between 1 and M that is not already
in the tree (so a random insertion can be performed). In terms of N and \alpha , what
is the running time of this operation?
b. Explain how to generate a random integer between 1 and M that is already in
the tree (so a random deletion can be performed). What is the running time of
this operation?
c. What is a good choice of \alpha ? Why?

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

What are three disadvantages of a civil service system?

Answered: 1 week ago

Question

What are three advantages of a civil service system?

Answered: 1 week ago