CleverSphere

Shortest word of an automaton

A breadth-first search from the start state finds the shortest accepted word and also settles whether the language is empty.

Rules

  • Breadth-first search from the start state
  • The first accepting state reached gives the length
  • No accepting state reachable: empty language

Your turn

Three problems on this topic. The software checks your answer exactly.

  1. 1 · Shortest word
  2. 2
  3. 3

How long is the shortest word the automaton accepts?

δab
→ q0q0q1
q1q2q0
*q2q3q3
q3q0q1

Length (ε has length 0)

Worked example

How long is the shortest word the automaton accepts?

δab
→ q0q3q0
q1q0q2
*q2q0q3
q3q1q2

Worked solution

  1. 1Breadth-first search from q0: the shortest word is ab.
  2. 2q0 → q3 → q2

Typical mistake: If the start state is accepting, the answer is 0.

Common questions

Can the answer be 0?

Yes, if the start state is accepting. Then the empty word is in the language.

Related

More topics