C3.ai · CS Fundamentals
Analyze the Time Complexity of Nested Loops
TrueInterview
October 27, 2026 · 1 min read
Work out how the running time of the C-style pseudocode below grows, and express it in Big-O / Big-Theta notation:
for (int i = 0; i < n; i++) {
for (int j = 0; j < i * i; j++) {
for (int k = i; ~k; k -= 1) {
temp++;
}
}
}
The expression ~k denotes bitwise NOT. Integers are stored in two's-complement form, and you may assume .
Loading comments…