AlgoViz

Palindromes

medium 22 min

A palindrome reads the same forwards and backwards.

Where it shows up

The same pattern appears across everyday software.

  • DNA restriction sites

    Many restriction enzymes cut DNA at sites like GAATTC, which read the same on one strand left to right as on the complementary strand right to left. Scanning a genome for such sites is a palindrome search with a complement-aware comparison, done with the same expand-around-centre idea.

  • CRISPR and RNA hairpins

    CRISPR stands for clustered regularly interspaced short palindromic repeats. Palindromic stretches in RNA fold back on themselves into hairpins, and the classic RNA folding algorithm (Nussinov) is an interval DP over s[i..j], built exactly like the longest palindromic subsequence table.

  • Word games and text tools

    Puzzle apps, crossword helpers and spelling games check and generate palindromes, usually after normalising case and dropping punctuation, which is the two-pointer check with skipping. Valid Palindrome is this exact problem.

  • Edit distance to a target shape

    "Fewest edits to make this a palindrome" appears in data cleaning and in competitive programming as minimum insertions, n − LPS. It is a special case of edit distance between a string and its reverse, the same table family used by diff tools.

  • String processing libraries

    Text-indexing structures such as palindromic trees (eertrees) and Manacher's algorithm power fast queries like "how many distinct palindromes does this text contain", used in bioinformatics pipelines and string-algorithm toolkits.