6989c3a91a
This algorithm is pretty interesting because it runs in linear time with respect to the length of the `corpus` string. It does this by using a sliding window hash. This hash -- because it's a sliding window -- runs in constant time for each iteration; we're only adding and subtracting one character each time and not re-hashing the whole "window". When our hashes match, only then do we compare the "window" to the `pattern`. String comparisons are linear because they compare each character to each character one at a time. But because we only compare strings when are hashes match (a check which runs in constant time), this spares us the performance hit. |
||
---|---|---|
.. | ||
advent-of-code-2019 | ||
crack_the_coding_interview | ||
data_structures_and_algorithms | ||
deepmind | ||
groceries | ||
habit-screens | ||
haskell-programming-from-first-principles | ||
README.md |
Scratch
The purpose of the scratch
directory is to host practice exercises. Practice
encompasses things like working on data structures and algorithms problems for
upcoming coding interviews or general aptitude as well as writing code snippets
to help me learn a new programming language or understand an unfamiliar concept.