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

  Conduct a set of preliminary discussions

Conduct a set of preliminary discussions with Andrews and Jones to discuss the various systems and the company's strategic vision. You also meet with the heads of Marketing, Travel & Tourism, and Technology to gather their initial thoughts for the..

  Determine the frequency (in hz)

A. Determine the frequency (in Hz) and the period (in s) for the sinusoidal wave described in the last problem. B. An oscilloscope shows a wave repeating every 27 ms. What is the frequency of the wave?

  What is inheritance

A. What is inheritance ?B.  What are different forms of inheritance?C. Give one example of single level inheritance in C++

  A video codec has to digitize an analog video signal

A video codec has to digitize an analog video signal that is band-limited to 5 MHz. If each sample of the video signal has to be encoded into one of 512 possible levels, and no compression techniques are used, the codec will generate a video bit rate..

  Write a script that creates and calls a stored procedure

Write a script that creates and calls a stored procedure named spInsertProduct that inserts a row into the Products table. This stored procedure should accept five parameters. One parameter for each of these columns

  Write an algorithm in structured english

Write a program in Python that will ask for the number of ticket sold for each type of tickets one by one. That is, it will first ask "Please enter the number of Platinum tickets sold". Once the user enters the number of Platinum tickets sold it w..

  What is the drive slack ram slack and file slack

Drive Slack: Suppose you create a text document containing 10,000 characters, - that is 10,000 bytes of data. a. Suppose you save this file on a FAT16, 3 GB Disk. What is the Drive Slack, Ram Slack, and File Slack.

  You mentioned normalization to cassia

In your discussion of the systems design phase, you mentioned normalization to Cassia. She would like you to explain the basics of normalization in plain English to help her understand the data design tasks.

  Where vs having in sql

Using WHERE or HAVING in your SQL statement, answer the following questions using the MOVIES Database available with this assignment.  Be sure to include your SQL code and a screen capture of your output for EACH question.  Do NOT decrease the size..

  What is the decimal value

assume that the following 10 bit numbers represents sighned integers using sign/magnitude notation. the sign is the leftmost bit and the remaining 9 bits represent the magnitude. What is the decimal value for 100000000.

  Create a gui application with jframe

Create a GUI application with JFrame that contains five labels describing reasons that a customer might not buy a specific product.

  Create an employeeexception class

Create an EmployeeException class whose constructor receives a String that consists of an employee's ID and pay rate. Create an Employee class with two fields, idNum and hourlyWage.

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