Your concept feed

24 ideas

A few small steps. No rush.

Follow the connections in this topic

Let’s picture it

Neighboring substrings share most characters.

abc
bcd

Windows abc and bcd overlap in b,c. Recomputing a numeric fingerprint from scratch repeats work.

Swipe when you’re ready
One little change

Remove, shift, add.

remove a
shift bc
add d

Subtract the outgoing character’s contribution, multiply the remaining fingerprint by the base, then add the incoming character.

Same idea. One more small step.
Now it has a name

A hash match is evidence, not equality.

same hash
verify text

Different strings can collide. Verify matching candidates or use collision-resistant engineering appropriate to the setting.

Want to try a tiny question?
No pressure. Just try it.

Does equal hash prove equal strings mathematically?

You can also keep scrolling
1 / 4
String algorithms

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Keep a small part of a row.

2
3

Our budget is 5. The values 2 and 3 fit together.

1 / 3
Let’s picture it

A mismatch need not erase everything.

abab matched
suffix ab
prefix ab

Pattern abab has matched, then the next character differs. Its suffix ab is also a prefix we already know.

Swipe when you’re ready
One little change

The prefix table stores fallback length.

pattern position
border length

For each pattern ending, remember the longest proper prefix that is also a suffix.

Same idea. One more small step.
Now it has a name

Fallback without moving text backward.

text stays
pattern falls back

On mismatch, shorten the matched pattern using that table. Every text position advances once overall.

Want to try a tiny question?
No pressure. Just try it.

Why not restart the pattern at zero after every mismatch?

You can also keep scrolling
1 / 4
String algorithms

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Neighboring substrings share most characters.

abc
bcd

Windows abc and bcd overlap in b,c. Recomputing a numeric fingerprint from scratch repeats work.

1 / 3
Let’s picture it

Ask the same prefix question everywhere.

prefix
suffix at i
match length

For each position i, how many characters from s[i:] match the beginning of s?

Swipe when you’re ready
One little change

Reuse one rightmost matching box.

left
i inside
right

If i lies inside a known prefix-matching interval, copy a safe lower bound from the corresponding prefix position.

Same idea. One more small step.
Now it has a name

Extend only beyond known work.

reuse inside
compare beyond

Compare characters only after the reused match reaches the box edge. The right boundary moves at most n times.

Want to try a tiny question?
No pressure. Just try it.

What does Z[i] measure?

You can also keep scrolling
1 / 4
String algorithms

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

A mismatch need not erase everything.

abab matched
suffix ab
prefix ab

Pattern abab has matched, then the next character differs. Its suffix ab is also a prefix we already know.

1 / 3
Let’s picture it

Every palindrome has a center.

a b a
center b

In abac, aba expands around b. Even palindromes center between characters.

Swipe when you’re ready
One little change

Transform to one center type.

#a#b#a#
one center rule

Separators turn aba into ^#a#b#a#$, so odd and even original palindromes both have character-like centers.

Same idea. One more small step.
Now it has a name

Mirror inside the rightmost palindrome.

mirror
center
right edge

A center inside a known palindrome can reuse its mirror radius, clipped by the right edge, then expand beyond it.

Want to try a tiny question?
No pressure. Just try it.

Does the mirrored radius always copy completely?

You can also keep scrolling
1 / 4
String algorithms

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Ask the same prefix question everywhere.

prefix
suffix at i
match length

For each position i, how many characters from s[i:] match the beginning of s?

1 / 3
Let’s picture it

Each position starts a suffix.

banana
anana
nana
ana, na, a

banana has suffixes banana, anana, nana, ana, na, a. Sorting them groups shared beginnings.

Swipe when you’re ready
One little change

Ranks can double known prefixes.

rank first half
rank second half

First rank one character. Then sort suffixes by the pair of ranks for their first 2ᵏ characters.

Same idea. One more small step.
Now it has a name

Neighbors reveal repeated substrings.

sorted suffixes
neighbor LCP

The longest common prefix of adjacent sorted suffixes gives repeated-prefix information across the text.

Want to try a tiny question?
No pressure. Just try it.

Why can two ranks represent a doubled prefix?

You can also keep scrolling
1 / 4
String algorithms

One small step at a time.

This idea builds on these smaller ones. Pick any to revisit it here.

Order can expose structure.

4
1
3
1

Unsorted values [4,1,3,1] hide equal neighbors and make smallest-first processing awkward.

1 / 3
You've reached the end of these ideas.Try them without the labels