Explaining O(n) and O(1)
O(n) vs O(1)
When we say an algorithm is O(n), we imply that it takes n steps to take this algorithm from start to finish, given n is the number of input, or in the array case, the length of an array.
For example, let's look at the following code sn...
cup-of-coding.hashnode.dev2 min read
Milo π³οΈβπ π¦ Xeon
I left Hashnode! https://miloxeon.com/articles
Wow, nice to see such a topic here! Definitely a must-read!
The key point to understand in the whole big-O thing is that it represents how the number of operations grows, not the number of operations itself.