Theory of Computation exercises with solutions

45 practice problems from the 15 lessons of the Theory of Computation course, in lesson order and from easy to hard inside each lesson. Open a problem, write your code and press Submit: the tests run in your browser and nothing is sent to a server.

15 easy problems 15 medium problems 15 hard problems

Alphabets, strings and languages

3 problems · Read the lesson

Deterministic finite automata (DFA)

3 problems · Read the lesson

Designing DFAs: memory, complement and product

3 problems · Read the lesson

Nondeterministic finite automata (NFA)

3 problems · Read the lesson

From NFA to DFA: the subset construction

3 problems · Read the lesson

Minimising a DFA

3 problems · Read the lesson

Regular expressions

3 problems · Read the lesson

From regular expression to NFA: Thompson's construction

3 problems · Read the lesson

Beyond regular: the pumping lemma

3 problems · Read the lesson

Context-free grammars

3 problems · Read the lesson

Parsing with the CYK algorithm

3 problems · Read the lesson

Pushdown automata

3 problems · Read the lesson

Turing machines

3 problems · Read the lesson

Decidability and the halting problem

3 problems · Read the lesson

P, NP and NP-completeness

3 problems · Read the lesson