What is Big O?
In computer science, big O is used to analyze how their running time or the space used by an algorithm.it is invented by ...
For further actions, you may consider blocking this person and/or reporting abuse
The last example doesn't look quadratic to me but linear, because the second loop is executed a fixed number of times. Its complexity would be O(10 * n), which is proportional to O(n)
Updated
O(10 *n) how ?
Can you explain please !
The author fixed it, but the code used to be something like:
The
console.log
statement is executedarr.length * 10
times. That's a complexity of O(10* n), n being the size of thearr
array.Looking forward to read the next tuts ! 👍
checkout next tutorial .
the last example should have
for (var j = 1; j <= n; j++) {
or
for (var j = 1; j <= i; j++) {
for 2'd loop
to be O(n2). That's critical. Any constants in Big O notation can be dropped
Updated
Ouch, logarithms one were the content I was looking for when I entered here, I hope you will post it soon.
checkout Logarithms
It would be nice if you could expand a bit on this topic since there's more to it.
The Big-O Cheat Sheet is nice, especially that poster!!