Generate a random integer

Assignment Help Basic Computer Science
Reference no: EM13968080

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 ran- dom, but close enough. You build a tree with N elements by inserting N elements chosen at random from the range 1 to M = αN. You then perform N2 pairs of inser- tions 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 α, 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 α? Why?

Reference no: EM13968080

Questions Cloud

Minimum number of nodes : 3. * a. Give a precise expression for the minimum number of nodes in an AVL tree of height h. b. What is the minimum number of nodes in an AVL tree of height 15?
Distance between the observation point : Find the distance between the observation point and the base of the Space Needle.
Problem regarding the appropriate node : a. Replace with the largest node, X, in TL and recursively remove X. b. Alternately replace with the largest node in TL and the smallest node in TR, and recursively remove the appropriate node.
Explain how marketers market to various consumers : List and describe at least five different reference groups that influence the purchasing behavior of different members of this family. Explain how marketers market to various consumers who have different needs, motivations, and reference groups.
Generate a random integer : 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?
What critical thinking issues are raised in the case : What critical thinking issues are raised in the case? The case presents various points of view on the issue of tourism in Venice. Whose perspective(s), if any, do you agree with
What is the maximum amount of money : What is the maximum amount of money the fisher can expect to make on a sustainable basis?
Analyze the bottom-up shortcomings : What are some insights about policy making and the policy process that one can discover.? Discuss the drug policy debate and why it needs to be followed more closely?
Maintaining the integrity of the linked list : We do not have pointers to any other nodes (except by following links). Describe an O(1) algorithm that logically removes the value stored in such a node from the linked list, maintaining the integrity of the linked list. (Hint: Involve the next n..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Converting binary numbers in decimal

Convert the given binary numbers in decimal: 101110; 1110101; and 110110100. Convert the given decimal numbers to bases indicated.

  A _______ is a set of commands

A _______ is a set of commands

  Which of the following can increase reliability

Which of the following can increase reliability considerably in an Ethernet LAN

  Windows tools and bsod errors

Windows Tools and BSOD Errors

  Math in a cylem j kjbnkjadjbv ojcojvpj vipjvjpvjpv

in a cylem j? kjbnkjadjbv ojcojvpj vipjvjpvjpv pvjpvjpvjpvj povjovjvojv pvjvjlvjnvpjvp. movjojv novjoivjo

  Define the term use case

Define the term ‘use case' and explain the various types of actors in a Use Case and Describe with examples ‘encapsulation', ‘information hiding', ‘polymorphism' and ‘data abstraction'.

  Find the number of steps per revolution.

If a given stepper motor has a step angle of 5 degrees, find the number of steps per     Revolution.

  Compensation and benefit strategy

Present to the management a revised compensation and benefit strategy. Your proposal should include a discussion of:

  Estimate the cost of the system

Estimate the cost of the system. To what degree were you able to get a better price through comparison shopping? If you are using a mail-order source, how does shipping affect your final cost

  Show the design of a modulo 7 asynchronous counter

Using positive edge triggered flip flops, show the design of a modulo 7 asynchronous counter that counts: 7,6...1,7, etc. You may assume that your flip flops have asynchronous Set and Reset inputs available. (Hint: Connect Q to the clock input of the..

  Storage of a large number of items in main memory

Storage of a large number of items in main memory, where accessing an item by its position, and avoiding problems caused by memory fragmentation, are important.

  What values are assigned to x when k has values

What values are assigned to x when k has values of 1,2,3,4, and 10?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd