A given program runs in 0.1sec for inputs of size N=1000. We have deduced that the time complexity of the program is of the form a N^(2), where a is some constant. How large instances can the program handle within 2 minutes?.
Added by Karen H.
Step 1
This means that the time taken by the program is directly proportional to the square of the input size N. Show more…
Show all steps
Your feedback will help us improve your experience
Liam Haas-Neill and 74 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Two algorithms take n^2 days and 2n seconds respectively to solve an instance of size n. What is the size of the smallest instance on which the former algorithm outperforms the latter? Approximately how long does such an instance take to solve?
Liam H.
Suppose you have algorithms with the six running times listed below. (Assume these are the exact number of operations performed as a function of the input size n.) Suppose you have a computer that can perform 10^10 operations per second, and you need to compute a result in at most an hour of computation. For each of the algorithms, what is the largest input size n for which you would be able to get the result within an hour? (a) n^2 (b) n^3 (c) 100n^2 (d) n log(n) (e) 2^n (f) 2^{2^n} (g) n^{4/3} (h) n*sqrt(n) (i) n^{10} (j) 3^n (k) n! (l) 2n^2 (m) n^{1.5} (n) n^2 log(n) (o) 2^{2^n}
Akash M.
What is the effect in the time required to solve a problem when you double the size of the input from $n$ to $2 n,$ assuming that the number of milliseconds the algorithm uses to solve the problem with input size $n$ is each of these functions? [Express your answer in the simplest form possible, either as a ratio or a difference. Your answer may be a function of $n$ or a constant. $]$ $$ \begin{array}{llll}{\text { a) } \log \log n} & {\text { b) } \log n} & {\text { c) } 100 n} \\ {\text { d) } n \log n} & {\text { e) } n^{2}} & {\text { f) } n^{3}}\\{\text { g) } 2^{n}}\end{array} $$
Algorithms
Complexity of Algorithms
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
100,000+
Students learning Computer Science with Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD