DEV Community

Discussion on: The algorithm behind Ctrl + F.

akhilpokle profile image
Akhil Author

Yep, that's the beauty of the algorithm since we will store the last index, the "skip" will be large. Since the skip is large if the characters from the end do not match, we will skip even more characters bringing down the overall number of comparisons.