Browsing as a guest — you can read this lesson freely, but you'll need to sign in to save notes or track progress.

Sign In
02

2 RuntimeAnalysis Quiz

Runtime Analysis Quiz

Test your understanding of Big-O notation, amortized analysis, and complexity concepts.

1

What is the time complexity of the following Java code? ```java for (int i = 0; i < n; i++) { System.out.println(arr[i]); } ```

2

What is the time complexity of this nested loop structure? ```java for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { System.out.println(arr[i][j]); } } ```

3

In Java's ArrayList, what is the **amortized** time complexity of the `add()` operation when adding elements to the end?

4

Compare the space complexity of storing 1000 integers in an **Array** vs. a **Singly LinkedList** in Java. Which statement is most accurate?

5

Consider a linear search algorithm searching for an element in an unsorted array. What are the **best case** and **worst case** time complexities?

🎓 Professor Ada's Reminder

Understanding Big-O notation isn't about memorizing formulas—it's about developing intuition for how algorithms scale. Always ask yourself: "If I double my input size, what happens to my runtime?" That's the heart of complexity analysis!

Keep reading — this lesson marks itself done automatically.