Construct Basic NFA

Learn to construct a Non Deterministic Finite Automation (NFA) with an alphabet ∑ = {0, 1} that accepts all strings ending with 01

106 Participants 30 Minutes Beginner

In this lab, you will delve into the fascinating world of automata theory, specifically focusing on Non-Deterministic Finite Automata (NFA). You will learn how to design an NFA that recognizes strings ending with "01." But before we dive into the lab steps, let's briefly cover some essential concepts and prerequisites.




To make the most of this lab, it's beneficial to have a basic understanding of the following topics:

1. Finite Automata: Finite automata are abstract machines used to solve problems and recognize patterns in strings. Understanding the basics of finite automata is crucial as it forms the foundation of NFAs.

2. Alphabets and Languages: In the context of automata theory, an alphabet is a set of symboA language is a set of strings over an alphabet. You should be familiar with these concepts.

3. Regular Expressions (Optional): Although not required, some knowledge of regular expressions, which are closely related to automata, can be helpful in grasping the concepts in this lab.


What is an NFA?

A Non-Deterministic Finite Automaton (NFA) is a computational model that recognizes languages. It is characterized by its ability to transition between states based on input symbols, but it can have multiple possible transitions for a given symbol, making it non-deterministic. This means that during processing, an NFA can explore multiple paths simultaneously.

  • NFA stands for non-deterministic finite automata. It is easy to construct an NFA than DFA for a given regular language.

  • The finite automata are called NFA when there exist many paths for specific input from the current state to the next state.

  • Every NFA is not DFA, but each NFA can be translated into DFA.

  • NFA is defined in the same way as DFA but with the following two exceptions, it contains multiple next states, and it contains ε transition.

NFA also has five states same as DFA, but with different transition function, as shown follows:

δ: Q x ∑ →2Q


  1. Q: finite set of states  

  2. : finite set of the input symbol  

  3. q0: initial state   

  4. F: final state  

  5. δ: Transition function  


Difference Between NFA and DFA:

In the world of finite automata, there are two primary types: Non-Deterministic Finite Automata (NFA) and Deterministic Finite Automata (DFA). Here are some key differences:

1. Determinism:

DFA: A DFA has a single, unique transition for each input symbol from each state. It's deterministic because, given a state and an input symbol, there's only one possible next state.

NFA: An NFA can have multiple possible transitions for the same input symbol from a single state, making it non-deterministic. This means that during processing, it can choose any of these transitions.

2. Acceptance Criteria:

DFA: In a DFA, acceptance is based on whether the machine ends in an accepting state after processing the entire input string.

NFA: An NFA can have multiple accepting states, and acceptance can be based on reaching any of these states.

3. State Complexity:

DFA: DFAs tend to have more states than NFAs to achieve the same language recognition.

NFA: NFAs can be more compact, as they allow for multiple transitions from a single state.



This lab will guide you through the process of constructing an NFA that recognizes strings ending with "01." You will gain insights into the differences between NFAs and DFAs, and how NFAs allow for non-deterministic behavior during string processing. By the end of this lab, you will have a practical understanding of how to design and use NFAs in language recognition, setting the stage for further exploration of automata theory and formal languages.

Construct Basic NFA


Have a doubt? Got stuck somewhere?



Related Labs



Theory of Computation

  • 30 m
  • Beginner
  • 45
Explore context-free grammars (CFG) and Chomsky Normal Form (CNF) using hands-on activity

Ambiguity in CFG

Theory of Computation

  • 30 m
  • Beginner
  • 17
Learn to identify and resolve ambiguity in grammars, and gain hands-on experience with parsing methods such as LL(1), LR(0), SLR(1), LR(1), and LALR(1)

Explore Pushdown Automata

Theory of Computation

  • 30 m
  • Beginner
  • 177
Explore PDA for recognition of context-free languages e.g. L = { 0^n 1^n | n≥0 }

Turing Machine Program

Theory of Computation

  • 30 m
  • Beginner
  • 92
Understand and run Palindrome validation program on Turing Machine Simulator