
Define the input size
Name each variable and identify what operation repeats. Separate the given input from additional storage.
ExampleFor a graph traversal, V counts vertices and E counts edges. For binary search, n counts sorted input elements.
Enter a claim and justify it
Enter time and space, and explain loops, recursion, and storage. State the relevant case.
ExampleIterative binary search halves the remaining interval each step. Worst-case time is O(log n). It uses O(1) auxiliary space for a fixed number of variables.
Check, compare, and transfer
Check the answer, inspect the reference derivation and growth visualization where available, then try the same explanation in Coding’s Complexity phase.
ExampleTwo separate passes over n items cost O(n). A full pass nested inside another costs O(n²). Explain what an inner loop does before multiplying.
Check your work
Your explanation defines the input size and identifies the operation and storage that dominate growth.
Try it yourself
Choose a loop example or write this variation in your notes. For each i from 0 through n − 1, the inner loop visits j from 0 through i. Enter a time and auxiliary space claim.
- What to look for
- The inner loop runs 1 + 2 + … + n times, giving Θ(n²) time. If the loops use a fixed number of variables and retain no growing collection, auxiliary space is Θ(1).