13. Algorithms and Discrete Structures

Basic Complexity Intuition — Quiz

Test your understanding of basic complexity intuition with 5 practice questions.

Read the lesson first

Practice Questions

Question 1

Which complexity class grows the fastest as the input size $n$ becomes very large?

Question 2

An algorithm always performs exactly $3$ basic steps, no matter how large the input is. What is its time complexity?

Question 3

A linear search checks items one by one until it finds a target or reaches the end of an array. In the worst case, what is the time complexity?

Question 4

A program has two nested loops. The outer loop runs $n$ times, and for each outer iteration the inner loop also runs $n$ times. How many times is the inner body executed?

Question 5

If an algorithm's running time roughly doubles whenever the input size doubles, which growth pattern is the best match?