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

  Information security audits

Which of the following would be part of an bi-annual corporate audit (see a-e) and what type of information would be gathered including which polices if any would apply?

  Price and higher you pay for gasoline

How information technology contributed to higher oil price and higher you pay for gasoline?

  Ethical debate on our information privacy

One lives in a world where the internet plays a pinnacle role in our day to day lives. Discuss how the internet has caused an ethical debate on our information privacy

  Analyze the data from this experiment (use a = 0.05)

Analyze the data from this experiment (use α = 0.05).

  Phases of organizational design strategy implementation

Describe one problem that could arise in each of the three phases of organizational design strategy implementation and describe its impact on the business.

  A security strategy involves risk assessment.

A key part of designing a security strategy involves risk assessment. Our tolerance to risk determines what provisions need to be in place to keep our risk at a manageable level. What is the process to determine an acceptable level of risk and how do..

  Describe an actuator that could accept an electrical input

Feedback control requires being able to sense the variable being controlled. Because electrical signals can be transmitted, amplified, and processed easily, often we want to have a sensor whose output is a voltage or current proportional to the va..

  Study how the predictor parameters vary

Study how the predictor parameters vary. If they converge and do not vary much after a while, test the resulting constant values as control parameters.

  Write a sequence of statements that creates a new file

There are two text files, whose names are given by two String variables , file1 and file2. These text files have the same number of lines. Write a sequence of statements that creates a new file whose name consists concatenating the names of the tw..

  Questionnaire for former and potential students

1. Design a questionnaire for former and potential students in SCR's training classes. Also, reply to Jesse's message about sampling. Give her a recommendation and reasons. Be sure to explain the reasoning behind the recommendations.

  Application uses both warehouse and operational data

Field sales people can have a sales database on their smart phones. The sales database contains sensitive, competitive information. Using their smart phones, the salespeople can query the data, update it, delete it, and place orders. This application..

  Briefly explain who a hacker is

Briefly explain who a hacker is and what the activities of a hacker are?

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