CS101: Big-O and How it’s Relevant
Big-O is a way of expressing time and space complexity of an algorithm. Complexity is the rate of growth given variable inputs. Complexity is implicitly expressed in worst-case unless otherwise stated.
For example:
function printArray(n) {
for(var i = 0; i < n.length; i++) {
console.log(n[i])
}
}
printArray
in this instance is O(n)
time complexity and O(1)
space complexity.