ArticleslgStudy

computer science

Glushkov's construction algorithm

Glushkov's construction algorithm is a computer 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 Glushkov's construction algorithm rather than just read about it. In short: In computer science theory – particularly formal language theory – Glushkov's construction algorithm, invented by Victor Mikhailovich Glushkov, transforms a given regular expression into an equivalent nondeterministic finite automaton (NFA). Thus, it forms a bridge between regular expressions and nondeterministic finite automata: two abstract representations of the same class of formal languages.

Glushkov's construction algorithm — main illustration
Glushkov's construction algorithm — illustration

Key takeaways

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

Reference excerpt

In computer science theory – particularly formal language theory – Glushkov's construction algorithm, invented by Victor Mikhailovich Glushkov, transforms a given regular expression into an equivalent nondeterministic finite automaton (NFA). Thus, it forms a bridge between regular expressions and nondeterministic finite automata: two abstract representations of the same class of formal languages. A regular expression may be used to conveniently describe an advanced search pattern in a "find and replace"–like operation of a text processing utility. Glushkov's algorithm can be used to transform it into an NFA, which furthermore is small by nature, as the number of its states equals the number of symbols of the regular expression, plus one. Subsequently, the NFA can be made deterministic by the powerset construction and then be minimized to get an optimal automaton corresponding to the given regular expression. The latter format is best suited for execution on a computer. From another, more theoretical point of view, Glushkov's algorithm is a part of the proof that NFA and regular expressions both accept exactly the same languages; that is, the regular languages. The converse of Glushkov's algorithm is Kleene's algorithm, which transforms a finite automaton into a regular expression. The automaton obtained by Glushkov's construction is the same as the one obtained by Thompson's construction algorithm, once its ε-transitions are removed. Glushkov's construction algorithm is also called The algorithm of Berry-Sethi, named after Gérard Berry and Ravi Sethi who worked on this construction.

Construction Given a regular expression e, the Glushkov Construction Algorithm creates a non-deterministic automaton that accepts the language L ( e ) {\displaystyle L(e)} accepted by e. The construction uses four steps:

Step 1 Linearisation of the expression. Each letter of the alphabet appearing in the expression e is renamed, so that each letter occurs at most once in the new expression e ′ {\displaystyle e'} . Glushkov's construction essentially relies on the fact that e ′ {\displaystyle e'} represents a local language L ( e ′ ) {\displaystyle L(e')} . Let A be the old alphabet and let B be the new one.

Step 2a Computation of the sets P ( e ′ ) {\displaystyle P(e')} , D ( e ′ ) {\displaystyle D(e')} , and F ( e ′ ) {\displaystyle F(e')} . The first, P ( e ′ ) {\displaystyle P(e')} , is the set of letters which occurs as first letter of a word of L ( e ′ ) {\displaystyle L(e')} . The second, D ( e ′ ) {\displaystyle D(e')} , is the set of letters that can end a word of L ( e ′ ) {\displaystyle L(e')} . The last one, F ( e ′ ) {\displaystyle F(e')} , is the set of letter pairs that can occur in words of L ( e ′ ) {\displaystyle L(e')} , i.e. it is the set of factors of length two of the words of L ( e ′ ) {\displaystyle L(e')} . Those sets are mathematically defined by

P ( e ′ ) = { x ∈ B ∣ x B ∗ ∩ L ( e ′ ) ≠ ∅ } {\displaystyle P(e')=\{x\in B\mid xB^{*}\cap L(e')\neq \emptyset \}} ,

D ( e ′ ) = { y ∈ B ∣ B ∗ y ∩ L ( e ′ ) ≠ ∅ } {\displaystyle D(e')=\{y\in B\mid B^{*}y\cap L(e')\neq \emptyset \}} ,

F ( e ′ ) = { u ∈ B 2 ∣ B ∗ u B ∗ ∩ L ( e ′ ) ≠ ∅ } {\displaystyle F(e')=\{u\in B^{2}\mid B^{*}uB^{*}\cap L(e')\neq \emptyset \}} . They are computed by induction over the structure of the expression, as explained below.

Step 2b Computation of the set Λ ( e ′ ) {\displaystyle \Lambda (e')} which contains the empty word ε {\displaystyle \varepsilon } if this word belongs to L ( e ′ ) {\displaystyle L(e')} , and is the empty set otherwise. Formally, this is

Λ ( e ′ ) = { ε } ∩ L ( e ′ ) {\displaystyle \Lambda (e')=\{\varepsilon \}\cap L(e')} .

… excerpt ends here. Continue reading the full article.

Illustrations

Glushkov's construction algorithm: Automaton constructed by Glushkov's algorithm - final version
Automaton constructed by Glushkov's algorithm - final version

Worked examples

Example 1 — a first encounter with Glushkov's construction algorithm

Start with the simplest possible case. Write down what Glushkov's construction algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer 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 Glushkov's construction algorithm 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 Glushkov's construction algorithm 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 Glushkov's construction algorithm

In research
Glushkov's construction algorithm appears in computer 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 Glushkov's construction algorithm 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
Glushkov's construction algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Finite-state machines, so understanding it makes those chapters shorter.
In everyday life
Look for Glushkov's construction algorithm 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 “Glushkov's construction algorithm” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Glushkov's construction algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Glushkov's construction algorithm 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 Glushkov's construction algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Glushkov's construction algorithm in simple terms?

In computer science theory – particularly formal language theory – Glushkov's construction algorithm, invented by Victor Mikhailovich Glushkov, transforms a given regular expression into an equivalent nondeterministic finite automaton (NFA). Thus, it forms a bridge between regular expressions and n…

Why does Glushkov's construction algorithm matter?

Because it connects several computer 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 Glushkov's construction algorithm?

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 Glushkov's construction algorithm.

Tags

  • Finite-state machines

Keep exploring