13.10 Exercises
Factual
Analyze the runtime of the following code in terms of
N
:
for (int i = 0; i < N; i++) {
int j = 0;
while (j < N) {
j = N;
}
}
Let . Which of the following statements is true?
Procedural
True or false. Suppose we have a function , and we are told . If we run on an input of size , then an input of size , it will take roughly 4 times as long.
True or false. Suppose we have a function , and we are told . If we run on an input of size 100, then an input of size 200, it will take roughly 4 times as long.
Metacognitive
Why do use asymptotics instead of empirical timing (for example, like the
Stopwatch
class from Lab 3)?
Last updated