Question: Problem 1. Roughly how long will it take for a linear time algorithm to run? What about a quadratic time algorithm? Or worse, a cubic?

 Problem 1. Roughly how long will it take for a linear

Problem 1. Roughly how long will it take for a linear time algorithm to run? What about a quadratic time algorithm? Or worse, a cubic? In this problem, we'll estimate these times. Suppose algorithm A takes n microseconds to run on a problem of size n, while algorithm B takes n2 microseconds and algorithm C takes n3 microseconds (recall that a microsecond is one millionth of a second). How long will each algorithm take to run when the input is of size one thousand, ten thousand, one hundred thousand, and one million? That is, fill in the following table: The answers for Algorithm A are already provided; you can use them to check your strategy. Express each time in either seconds, minutes, hours, days, or years. Use the largest unit that you can without getting an answer less than one. For example, instead of " 365 days", say "1 year"; but use " 364 days" instead of "0.997 years". Round to two decimal places (it's OK for an answer to round to 0.00 ). Hint: you can calculate your answers by hand, or you can write some code to compute them. If you write code, provide it with your solution - if you solve by hand, show your calculations

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!