Easton Man's Channel
8 hours ago
Daniel Lemire's blog
Java’s String.indexOf can be slow (quadratic)
source
Daniel Lemire's blog
Java’s String.indexOf can be slow (quadratic)
In Java, you find the location of a substring using indexOf. String haystack = "The quick brown fox jumps over the lazy dog"; String needle = "fox"; int index = haystack.indexOf(needle); Naively, you might implement indexOf by a loop inside a loop, like so.…
Home
Powered by
BroadcastChannel
&
Sepia