O(10 *n) how ?
Can you explain please !
The author fixed it, but the code used to be something like:
for (var i = 0; i < arr.length; i++) { for (var j = 0; j < 10; j++) { console.log(arr[i] + arr[j]) } }
The console.log statement is executed arr.length * 10 times. That's a complexity of O(10* n), n being the size of the arr array.
console.log
arr.length * 10
arr
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.