Hacker News new | ask | show | jobs
by dentalperson 1291 days 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?
1 comments

It'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.
But 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.