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

  Vital signs of hospital patients are monitored

Vital signs of hospital patients are monitored and reported automatically.  While each monitor has alarms which go off when a reading is out of range, combinations of readings are also important.  Common vital signs and normal range is given below.

  Formulas and functions in excel

you must submit your training outline which includes topics and sub topics and time estimates. It should be professional and organized. If you take information from another source - include APA citations. each member of your team must train on a ..

  Describing the features of the different computers

Write a 350- to 700-word summary describing the features of the different computers such as memory, processor, monitor/screen size, operating system, etc.

  Describe how you will test for associated risk

Given the following categories or areas where risk exists, and then the 3 assets for each, describe how you will test for associated risk:

  Solve the system of linear equations

Use Crammers rule to solve the system of linear equations, if possible.

  Given a set of integer numbers

Given a set of integer numbers as int A[ ] = { 12, 6, 51, 4, 3, 7, 19, 8, 0, 21}, please write down the divide and conquer procedure of quick sort (step by step), include all left and right positions adjustment, and overwriting.

  Explains about the algorithm insertionsort

The insertion sort algorithm is stated below. Operation of insertion sort can be described as follows. The list at any moment is divided into two parts: sorted and unsorted. In each pass of the algorithm, the first element of the unsorted sub-list..

  What are some tips for developing and using the bis

Was the introduction of the Monster Thickburger a good idea or an example of information leading to a wrong decision?

  Suppose we wish to segment an image by detecting edges

Suppose we wish to segment an image by detecting edges that separate segments. What might make this easy, or difficult?

  Find the new position of the fermi-level

In an N-type semi conductor, the Fermi-level lies 0.3 eV below the conduction band at 27oC . If the temperature is increased to 55o C , find the new position of the Fermi-level.

  Write the document''s topic as the document''s header

Write the document's topic as the document's header. On the document's first page, insert a list of the document's paragraph names. The paragraph names briefly describe the paragraphs' contents. Add a hard page break to the first page to make sure th..

  Present to network administrators

Discuss how Trusts and Permissions differ and the challenges they present to network administrators.

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