Skip to content

String-to-String Correction Problem

Find the minimum total cost of transforming one symbol string into another by permitted single-symbol edits.

Core Idea

The string-to-string correction problem asks for the least total cost of changing a finite source string into a target string using permitted one-symbol substitutions, deletions and insertions. Wagner and Fischer allow a nonnegative cost for each particular edit; their minimum is over all edit sequences that actually reach the target. The optimum is the problem's answer, while recovering an optimal script is optional and filling a dynamic-programming table is one solution method.[1]

How would you explain it like I'm…

Cheapest Word Fix

Say you want to turn the word 'cat' into 'cart'. You could add a letter, take one away, or swap one letter for another, and each change costs a few pennies. The string-to-string correction problem asks: what is the cheapest total cost to turn one word into the other?

Cheapest Way to Edit Words

You have two words or strings of letters. You are allowed three kinds of changes: swap one letter for another, delete a letter, or insert a letter. Each particular change has its own cost; changing 'a' to 'e' might cost a different amount than changing 'a' to 'z'. The string-to-string correction problem asks for the smallest total cost to turn the first string into the second. The answer is that smallest number, though you can also find the list of changes that achieves it.

Minimum-Cost Edit Distance

The string-to-string correction problem asks for the minimum total cost to transform a string A into a string B using permitted edits. In Wagner and Fischer's version the edits are changing one symbol to another, deleting a symbol, and inserting a symbol, and every particular operation, such as changing 'a' to 'b', can have its own nonnegative cost. The answer is a single minimum value, often called an edit distance, though it need not satisfy all the rules of a mathematical distance. A cheapest sequence of edits can be recovered if wanted, but it is not required. The well-known dynamic programming algorithm solves the problem; it is not the definition, and adding new edit types such as swapping neighbors changes the problem.

 

The string-to-string correction problem: given finite strings A and B over an alphabet, find the least total cost of a sequence of permitted edits transforming A into B. In Wagner and Fischer's formulation the primitives are change one symbol, delete one symbol, and insert one symbol, with a nonnegative cost assigned to each particular operation (not just each class). Costs are summed along a transforming sequence and minimized over all feasible sequences; the value may be called an edit distance even if it is not symmetric or does not separate distinct strings, so it need not be a metric. The output is the minimum value; an optimal edit sequence or noncrossing trace can be recovered but is not constitutive. Wagner and Fischer's prefix dynamic program, with a three-neighbor recurrence, is a solver derived from the specification and depends on this three-operation grammar. Adding primitive adjacent transpositions or other edits requires a changed formulation.

Scope of Application

In spelling correction, input and candidate words can be compared using character-sensitive prices, such as lower costs for plausible keyboard mistakes; the score alone does not certify intended meaning. In the original article's different LCS setting, assigning insertion/deletion cost $1\(, unequal substitution \$2\) and matching $0$ makes the longest-common-subsequence length equal to \((|A|+|B|-\delta(A,B))/2\). The frozen seed's version-storage use is not claimed because the inspected original does not establish it.[1]

Clarity

Declare source and target direction, the three permitted primitive edits, and costs for particular operations. A uniform unit-cost Levenshtein setting is narrower than the original weighted problem. The result need not be a mathematical metric unless added symmetry and positivity conditions hold. An adjacent swap is not one primitive operation in this grammar, and an arbitrary feasible script is not necessarily least-cost.[1]

Manages Complexity

The formalization replaces an indefinite search for “similar words” with a feasible edit-path set, additive costs and one global minimum. Wagner and Fischer derive a three-predecessor prefix recurrence for that operation grammar, yielding a solver whose time is proportional to the product of the string lengths; their trace algorithm can additionally recover a least-cost path. Those algorithmic benefits follow from, but do not define, the weighted problem.[1]

Abstract Reasoning

For cat to cot, an illustrative policy charging $0.2$ for \(a\to o\) and at least $1$ for every other nonidentity edit makes the one-change path cheaper than deleting and reinserting the middle symbol. For ABC to AC under the article's LCS costs, delete B for cost $1$ and infer LCS length \((3+2-1)/2=2\). Both cases have typed strings, allowed local edits, nonnegative operation costs, feasible transforming sequences and a minimum objective, but use different cost policies and downstream purposes.[1]

Knowledge Transfer

The weighted correction problem transfers literally among string-processing tasks when all five roles remain; spelling and LCS illustrate this within the formal domain. Its proposed strict parent is live prime Optimization, not Dynamic Programming (a solver) or Distance (a resulting value). Generic minimum-cost transformation outside symbol strings instantiates the broader parent, not automatically the named problem.[1]

Relationships to Other Abstractions

Local relationship map for String-to-String Correction ProblemParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.String-to-StringCorrection ProblemDOMAINPrime abstraction: Optimization — is a kind ofOptimizationPRIME

Current abstraction String-to-String Correction Problem Domain-specific

Parents (1) — outgoing typed relations

  • String-to-String Correction Problem is a kind of Optimization Prime

    Minimum-cost string correction is a constrained discrete optimization problem over edit sequences.

Hierarchy path (1) — routes to 1 parentless root

  • String-to-String Correction Problem → is a kind of Optimization

Neighborhood in Abstraction Space

String-to-String Correction Problem sits in a moderately populated region (50th percentile for distinctiveness): it has near-neighbors but no dense thicket of look-alikes.

Family — Type Systems & Functional Constructs (20 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] Robert A. Wagner and Michael J. Fischer, “The String-to-String Correction Problem”, Journal of the ACM 21(1), 1974, pp.168–173: §2 definition and metric qualification; §4 recurrence and Algorithms X/Y; §5 LCS specialization. registry ↩a ↩b ↩c ↩d ↩e ↩f