Re:Why Layoffs Don't Work
by Tainnor on Tuesday March 11, 2025 @10:21AM
(#43332723)
> 'finding if a string is a substring of another string'
Unless you mean using a "substring" function or regexes... coming up with the naïve O(n^2) algorithm is indeed easy, but finding a fast algorithm like KMP is, I would say, non-trivial?
For the "second-largest number in array" it's rather easy to come up with an O(n) algorithm, so I would consider the two cases to be different.
Unless you mean using a "substring" function or regexes... coming up with the naïve O(n^2) algorithm is indeed easy, but finding a fast algorithm like KMP is, I would say, non-trivial?
For the "second-largest number in array" it's rather easy to come up with an O(n) algorithm, so I would consider the two cases to be different.