DSA SheetLesson · no judge

CODE DRILL 2 · RUN ONLY

Write it, run it, read the output

This is a scratch drill — your code runs, nothing is graded or recorded. No test cases, no expected output, no verdict.

TASK

Implement analyze for A = [6, 2, 9, 1] and n = 4. Verify that the returned total is 27, print the scan, nested, and doubling phase counts, and then report the overall classification as O(n^2).

Java
Loading editor…

OUTPUT

Sample
returned total: 27
scan iterations: 4
nested iterations: 6
doubling iterations: 2
time complexity: O(n^2)

What a finished answer prints, from the lesson. Nothing has run yet — press Run and this is replaced by your program’s own output.

Previous · How to Calculate Time Complexity?