ArticleslgStudy

science

Closest string

Closest string is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Closest string rather than just read about it. In short: In theoretical computer science, the closest string is an NP-hard computational problem, which tries to find the geometrical center of a set of input strings. To understand the word "center", it is necessary to define a distance between two strings.

Closest string — main illustration
Closest string — illustration

Key takeaways

  • Closest string belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Closest string to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Closest string from memory before moving on to harder problems.

Reference excerpt

In theoretical computer science, the closest string is an NP-hard computational problem, which tries to find the geometrical center of a set of input strings. To understand the word "center", it is necessary to define a distance between two strings. Usually, this problem is studied with the Hamming distance in mind.

Formal definition More formally, given n strings s1, s2, ..., sn of length m, the closest string problem seeks a new string s of length m such that d(s,si) ≤ k for all i, where d is the Hamming distance, and where k is as small as possible. A decision problem version of the closest string problem, which is NP-complete, instead takes k as another input and questions whether there is a string within Hamming distance k of all the input strings. The closest string problem can be seen as a special case of the generic 1-center problem in which the distances between elements are measured using Hamming distance.

Motivation In bioinformatics, the closest string problem is an intensively studied facet of the problem of finding signals in DNA.

Simplifications and data reductions Instances of closest string may contain information that is not essential to the problem. In some sense, the usual input of closest string contains information, that does not contribute to the hardness of the problem. For example, if some strings contain the character a, but none contains the character z, replacing all as with zs would yield an essentially equivalent instance, that is: from a solution of the modified instance, the original solution can be restored, and vice versa.

Normalizing the input When all input strings that share the same length are written on top of each other, they form a matrix. Certain row types have essentially the same implications to the solution. For example, replacing a column with entries (a, a, b) with another column (x, x, y) might lead to a different solution string, but cannot affect solvability, because both columns express the same structure, viz. the first two entries being equal, but different from the third one. An input instance can be normalized by replacing, in each column, the character that occurs the most often with a, the character that occurs the second most often with b, and so forth. Given a solution to the normalized instance, the original instance can be found by remapping the characters of the solution to its original version in every column. The order of the columns does not contribute to the hardness of the problem. That means, if we permute all input strings according to a certain permutation π and obtain a solution string s to that modified instance, then π−1(s) will be a solution to the original instance.

Example

Given an instance with three input strings uvwx, xuwv, and xvwu. This could be written as a matrix like this:

The first column has the values (u, x, x). As x is the character that appears the most often, we replace it by a, and we replace u, the second most often character, by b, obtaining the new first column (b, a, a). The second column has the values (v, u, v). As for the first column, v is replaced by a and u is replaced by b, obtaining the new second column (a, b, a). Doing the same with all columns gives the normalized instance

Data reduction obtained from normalization Normalizing the input reduces the alphabet size to at most the number of input strings. This can be useful for algorithms whose running times depend on the alphabet size.

Approximability Li et al. evolved a polynomial-time approximation scheme which is practically unusable because of the large hidden constants.

Fixed-parameter tractability Closest String can be solved in O(kL+kd⋅dd), where k is the number of input strings, L is the length of all strings and d is the desired maximum distance from the solution string to any input string.

Relations to other problems Closest string is a special case of the more general closest substring problem, which is strictly more difficult. While closest string turns out to be fixed-parameter tractable in a number of ways, closest substring is W[1]-hard with regard to these parameters.

References

Worked examples

Example 1 — a first encounter with Closest string

Start with the simplest possible case. Write down what Closest string claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Closest string before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Closest string ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Closest string

In research
Closest string appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Closest string in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Closest string is common in secondary-school and first-year university syllabi. It links to neighbouring topics Formal languages, NP-hard problems, so understanding it makes those chapters shorter.
In everyday life
Look for Closest string outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Closest string” →

How to study Closest string in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Closest string means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Closest string out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Closest string in simple terms?

In theoretical computer science, the closest string is an NP-hard computational problem, which tries to find the geometrical center of a set of input strings. To understand the word "center", it is necessary to define a distance between two strings.

Why does Closest string matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Closest string?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Closest string.

Tags

  • Formal languages
  • NP-hard problems

Keep exploring