Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started