Runtime Patterns Flashcards

1
Q

Incrementing/decrementing by a constant.

A

O(n) - i.e. +/-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Incrementing/Decrementing by a constant factor

A

O(logn) i.e. */÷

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

While( i > 1)
for(j <- 1 to i)
O(1)
i <- i/2

A

O(n) ? Something to do with how technically both loops are being decremented at the same rate?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Incrementing/Decrementing by a constant power

A

O(loglogn) i.e. sqrt(n)/n^2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly