3 ms·
I've seen this use of constants inside big O notation in leetcode and 'informal' discussions. Is it pedantic to say that O(NM) == O(N) if M is a constant (in t
by dentalperson 4y ago
I've seen this use of constants inside big O notation in leetcode and 'informal' discussions. Is it pedantic to say that O(NM) == O(N) if M is a constant (in this case since it's bound by 26)? Or is this the current and expected usage?
- tkzed49 4y agoIt's correct to omit constants from big O, but in the article W is a distinct input variable so the usage is valid. The size of the window W is bound by N, not a constant 26.
- ErikCorry 4y agoBut it's impossible for W to be bigger than 26 since you can't have 27 letters in a row that are all different. Normally for a search algorithm the size of the alphabet is assumed to be constant.