Skip to content
UPEEC

Time Complexity

Count how the number of basic steps grows with input size $n$.

Easy
Comments 0

A single loop is O(n)O(n); two nested loops O(n2)O(n^2); halving each step O(log⁡n)O(\log n). Rough guide for 1 second: n≤108n \le 10^8 for O(n)O(n), 10610^6 for O(nlog⁡n)O(n\log n), 10410^4 for O(n2)O(n^2).

Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.

Discussion (0)

Sign in or join free to ask questions and discuss this topic.