2 ms·
Correct, OP's example contained an O(n) function: > For example, the following function is O(n) because the algorithm grows in proportion to its input n: [...]
by shawnz 13y ago
Correct, OP's example contained an O(n) function:
> For example, the following function is O(n) because the algorithm grows in proportion to its input n: [...]
OP's question was whether there exists a similarly simple example of O(log n), which is not related to what anonymouz was commenting on. (or I'm misunderstanding?)