3 ms·
There is nothing wrong with O(n). It can be faster than O(1) depending on the size of n and what you're doing (small arrays are usually faster than hashmaps for
by arp242 3y ago
There is nothing wrong with O(n). It can be faster than O(1) depending on the size of n and what you're doing (small arrays are usually faster than hashmaps for example).
Big-O just tells you how something scales. It doesn't really tell you how fast something is.