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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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