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

  Distinction between input and output lines

How many cross points would be required if there were no distinction between input and output lines (i.e., if any line could be interconnected to any other line serviced by the crossbar)?

  Integration layers

Integration layers

  Research options for improving the current use of tcp/ip

Research options for improving the current use of TCP/IP and recommend new software and equipment that's available. Describe how use of equipment, software, and multiplexing could aid in improving use for communications which would reduce network con..

  Resultant data corporation

Resultant Data Corporation, a large and well-respected database consulting firm. One of your clients, an international pharmaceutical company, has requested some assistance in creating a new database. The database will be used for tracking and managi..

  Assistant author of a publishing company

You are working as the assistant author of a publishing company and are given an opportunity to become the author of a study guide for primary schools.

  Reasoning for choosing the virtualisation technology

Among VMware, Hyper V and Xen server we have to choose one to work upgrading the windows 8.1 from 7 version without refreshing the desktop.

  Create a similar analogy for a high school reunion committee

Create a similar analogy for a high school reunion committee, a professional event planner, and a hotel event vendor that would manage the actual event.

  What does the push transition do in powerpoint presentation

What does the "Push" transition do in a PowerPoint Presentation

  Develop an activity diagram for the scenario

Using the Activity Diagram above, produce a system sequence diagram, i.e. only include two swimlanes - one for the actor (PSSM employee) and the other for the entire system as a system class object.

  Use openoffice software to build tables

PART 1 You are required to use OpenOffice software to build tables, write, and execute queries.Step 1Build a Database named DBMS Course Project. The database should include following tables.

  Explain effective site navigation from internet

Students will research the best practices for site navigation and locate the example of effective site navigation from Internet.

  Write a mips program to complete the following functions

Write a MIPS program to complete the following functions. You must write comments and follow the register convention.

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