GryllsP's blog

By GryllsP, history, 7 hours ago, In English

What are some good string algorithms that everyone should know in competitive programming?

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
6 hours ago, # |
  Vote: I like it +4 Vote: I do not like it

KMP and Trie

good luck!

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it
  1. String Matching
  2. String Sorting
  3. Regular Expressions
  4. Kunath-Morris-Pratt(KMP) algorithm
  5. Boyer-Morre Algorithm
  6. Robin-Karp Algorithm
  7. Z-Algorithm
»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Although you have to take some precaution against getting hacked on codeforces, I don't think there's a more versatile string algorithm than the polynomial rolling hash. It's a relatively simple algorithm that allows you to carry over your knowledge of prefix sums (which everyone should already have quite a lot of experience with) and apply them to string problems.