Bound on the number of times heap

Assignment Help Basic Computer Science
Reference no: EM131240123

A number k > 1 is called humble if the only prime factors of k are 3 and 5. Consider the task of,on input n, outputting the n smallest humble numbers and the following algorithm to do it:

Humble(n)

count = 0, prevOutput = 0

Heap.Insert(3)

Heap.Insert(5)

while (count n)

cur = Heap.ExtractMin

if cur != prevOutput

then output cur

Heap.Insert(3*cur)

Heap.Insert(5*cur)

count = count + 1

prevOutput = cur

(a) Argue that the algorithm above (1) outputs numbers in increasing order, (2) doesnot output any number twice, (3) only outputs humble numbers, and (4) outputs all of thefirst n humble numbers.

(b) Derive an exact (i.e., no O-notation) bound on the number of times Heap. Insertis called.

(c) Bound exactly the number of times Heap.ExtractMin is called.(Hint: Use (b).)

(d) Use the answers to (b) and (c) above to argue that Humble runs in O(n log n)time. Assume that arithmetic can be performed in O(1) time.

Reference no: EM131240123

Questions Cloud

How many games are played in total : Let's generalize Problem 6 to a regional Ultimate Frisbee tournament where there are n teams attending. Teams are assigned numbers (1 through n) when they register. As before, each team will play each other exactly once.
Briefly describe the charities you selected : Write a 1 page memorandum to the partners of Davis and Williams. Briefly describe the charities you selected (1-2 sentences) and your recommendation of which charity they should support.
Discuss a company that does an effective job of utilizing : Construct a 2-3 page paper, based on the four characteristics of a product with potential for sustainable competitive advantage and based on the research you conducted; identify and discuss a company that does an effective job of utilizing these r..
How many armbands need to be grabbedsome of the players deci : How many armbands need to be grabbed in order to assure that one of the teams has at least seven players?
Bound on the number of times heap : (a) Argue that the algorithm above (1) outputs numbers in increasing order, (2) doesnot output any number twice, (3) only outputs humble numbers, and (4) outputs all of thefirst n humble numbers. (b) Derive an exact (i.e., no O-notation) bound on ..
What if the three flavors have to be different : Four teams are attending a local Ultimate Frisbee meet. If each team plays each other team exactly once, how many games are played?
Delete a database table : Create a trigger that will display warning message, "please consult with DBA first before delete a database table", when user attempting to delete it
Are the 4ps no longer relevant : Are the 4Ps no longer relevant? If they are, are they only relevant to certain industries, channels, or products? Which ones? Are the 4Cs able to replace the 4Ps in every business environment?
Keys to designing a successful data communications network : What are the keys to designing a successful data communications network? -  How does the traditional approach to network design differ from the building-block approach?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Training and education for earthquake preparedness

Finally, the committee will need to propose policies on training and education for earthquake preparedness. Both the organization's employees and the public will need education and training for the earthquake preparedness plan to be truly effectiv..

  What are the data entities of enterprise

Consider a student club or organization in which you are a member. What are the data entities of this enterprise? List and define each entity. Then develop an enterprise data model, showing entities and important relation between them.

  Determine the maximum period obtainable from lcg

Determine the maximum period obtainable from following LCG? Xn+1 = aXn (mod 24). What must be the value of a?

  Retrieves a student name and three scores

Write an application that retrieves a student name and three scores per line from a text file. Process the values by calculating the average of the scores per student. Write the name and average to a different text file. Test your application with a ..

  Analyze the use of gestures in ipads

Analyze the use of gestures in iPads. Address how users feel about gestures. Evaluate how users feel about the user input when it comes to filling out complicated forms on the iPad.

  Discuss the runway excursion

There are five imaginary surfaces that make up an airport's navigable airspace.  Most aviation accidents happen in the primary surface, and they are usually the flavor of runway incursions.  Do some research and tell the class why you think these run..

  Computing machinery and intelligence

Read the paper by Alan Turing, "Computing Machinery and Intelligence". In this paper, he describes a test that could be used to determine if a machine is intelligent. He referred to the test as the "Imitation Game".

  What is the hit ratio taking in to consideration

What is the average access time of the system for both read and write requests.

  Standard error of the mean in example

This distribution of times follows the normal distribution and the standard deviation is 80 minutes. A consumer watchdog agency selects a random sample of 40 taxpayers. a. What is the standard error of the mean in this example? (Round your answer t..

  Best way to multiply a chain

What is the best way to multiply a chain of matrices with dimensions that are 10 x 5, 5 x 2, 2 x 20, 20 x 12, 12 x 4, and 4 x 60? Please show work.

  Compare and contrast the update styles of microsoft

From the e-Activity, compare and contrast the update styles of Microsoft's Internet Explorer and Google Chrome and determine which style you believe to be more effective for organizations. Justify your response.

  Draw a constellation pattern for a modem

Draw a constellation pattern for a modem that uses eight equally spaced phase angles and four equally spaced amplitude levels. If the modem operates at 4800 baud, what is the bit rate?

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