3 ms·
O(5n) is the same thing as O(n), because we ignore constant factors in O notation. So, for a fixed size array of vowels, counting the vowels in a string is lin
by Tainnor 6y ago
O(5n) is the same thing as O(n), because we ignore constant factors in O notation.
So, for a fixed size array of vowels, counting the vowels in a string is linear in the length of the string (it can't be sublinear, because we need to look at each character, and the straightforward algorithm is linear).
- formerly_proven 6y ago> O(5n) is the same thing as O(n), because we ignore constant factors in O notation. Even better. f \in O(g) means there is some point and some factor after which f <= c*g. This means O(n²+21371232138091293n) and O(n²) are the same.