×
1 Choose EITC/EITCA Certificates
2 Learn and take online exams
3 Get your IT skills certified

Confirm your IT skills and competencies under the European IT Certification framework from anywhere in the world fully online.

EITCA Academy

Digital skills attestation standard by the European IT Certification Institute aiming to support Digital Society development

LOG IN TO YOUR ACCOUNT

CREATE AN ACCOUNT FORGOT YOUR PASSWORD?

FORGOT YOUR PASSWORD?

AAH, WAIT, I REMEMBER NOW!

CREATE AN ACCOUNT

ALREADY HAVE AN ACCOUNT?
EUROPEAN INFORMATION TECHNOLOGIES CERTIFICATION ACADEMY - ATTESTING YOUR PROFESSIONAL DIGITAL SKILLS
  • SIGN UP
  • LOGIN
  • INFO

EITCA Academy

EITCA Academy

The European Information Technologies Certification Institute - EITCI ASBL

Certification Provider

EITCI Institute ASBL

Brussels, European Union

Governing European IT Certification (EITC) framework in support of the IT professionalism and Digital Society

  • CERTIFICATES
    • EITCA ACADEMIES
      • EITCA ACADEMIES CATALOGUE<
      • EITCA/CG COMPUTER GRAPHICS
      • EITCA/IS INFORMATION SECURITY
      • EITCA/BI BUSINESS INFORMATION
      • EITCA/KC KEY COMPETENCIES
      • EITCA/EG E-GOVERNMENT
      • EITCA/WD WEB DEVELOPMENT
      • EITCA/AI ARTIFICIAL INTELLIGENCE
    • EITC CERTIFICATES
      • EITC CERTIFICATES CATALOGUE<
      • COMPUTER GRAPHICS CERTIFICATES
      • WEB DESIGN CERTIFICATES
      • 3D DESIGN CERTIFICATES
      • OFFICE IT CERTIFICATES
      • BITCOIN BLOCKCHAIN CERTIFICATE
      • WORDPRESS CERTIFICATE
      • CLOUD PLATFORM CERTIFICATENEW
    • EITC CERTIFICATES
      • INTERNET CERTIFICATES
      • CRYPTOGRAPHY CERTIFICATES
      • BUSINESS IT CERTIFICATES
      • TELEWORK CERTIFICATES
      • PROGRAMMING CERTIFICATES
      • DIGITAL PORTRAIT CERTIFICATE
      • WEB DEVELOPMENT CERTIFICATES
      • DEEP LEARNING CERTIFICATESNEW
    • CERTIFICATES FOR
      • EU PUBLIC ADMINISTRATION
      • TEACHERS AND EDUCATORS
      • IT SECURITY PROFESSIONALS
      • GRAPHICS DESIGNERS & ARTISTS
      • BUSINESSMEN AND MANAGERS
      • BLOCKCHAIN DEVELOPERS
      • WEB DEVELOPERS
      • CLOUD AI EXPERTSNEW
  • FEATURED
  • SUBSIDY
  • HOW IT WORKS
  •   IT ID
  • ABOUT
  • CONTACT
  • MY ORDER
    Your current order is empty.
EITCIINSTITUTE
CERTIFIED

Can a simple sorting algorithm be considered as an FSM? If yes, how could we represent it with a directed graph?

by Aida Basic / Saturday, 24 January 2026 / Published in Cybersecurity, EITC/IS/CCTF Computational Complexity Theory Fundamentals, Finite State Machines, Introduction to Finite State Machines

The question of whether a simple sorting algorithm can be represented as a finite state machine (FSM) invites a rigorous exploration of both the formalism of FSMs and the operational structure of sorting algorithms. To address this, it is necessary to clarify the nature and expressive power of FSMs, understand the computational process of sorting algorithms, and demonstrate the mapping between the two, particularly through the lens of directed graphs.

Finite State Machines: Definition and Expressive Power

A finite state machine, in the classical sense, is a computational model consisting of a finite set of states, a set of input symbols, a transition function that maps state-input pairs to states, a start state, and a set of accept (final) states. FSMs are classified as deterministic (DFA) or nondeterministic (NFA). They are characterized by their inability to store arbitrary amounts of information: they have no memory other than the current state.

The computational power of FSMs is limited to recognizing regular languages—those expressible by regular expressions. FSMs cannot count arbitrarily, nor can they track unbounded data. They are excellent for modeling systems with a finite number of configurations, such as protocol handlers, lexical analyzers, or simple control flow in embedded systems.

Sorting Algorithms: Operational Characteristics

Sorting algorithms, such as bubble sort, selection sort, and insertion sort, are defined procedures for rearranging the elements of a list according to a specific order (e.g., ascending or descending). These algorithms typically require the ability to address and manipulate elements at arbitrary positions in a list, keep track of indices (often two or more), and perform iterative or nested operations.

For instance, consider the bubble sort algorithm, which repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order. This process continues until no swaps are needed, indicating the list is sorted.

FSM Representation of Sorting Algorithms: The Theoretical Challenge

FSMs, by their nature, lack the kind of memory or storage necessary to keep track of indices or the state of an arbitrary-length list. Sorting, in general, requires mechanisms beyond the capacity of an FSM since FSMs cannot store the positions or values of data elements when the input size is not fixed.

However, if the size of the input list is fixed and known in advance (for example, sorting a list of exactly three elements), it becomes possible to represent the sorting process as an FSM. Each possible ordering of the three elements can be considered a distinct state. The transitions between states are driven by comparisons and swaps, modeled as input symbols or transition labels.

Directed Graph Representation

A finite state machine can be visually represented as a directed graph (also known as a state transition diagram). In this graph:

– Nodes (Vertices): Each node represents a distinct state of the system. For a sorting FSM with a fixed-length list, each state would correspond to a specific permutation of the list.
– Edges (Directed Arcs): Each directed edge represents a transition from one state to another, triggered by an input (such as the outcome of a comparison and/or swap).
– Start Node: The initial state of the system, representing the original, unsorted arrangement.
– Accepting/Final Nodes: States that correspond to the sorted arrangement(s) of the list.

Example: FSM for Bubble Sort on a List of Three Elements

Suppose we wish to sort a list [a, b, c] with the elements being distinct. There are 3! = 6 possible permutations of the list. Each permutation is a state in the FSM. The transitions are determined by the bubble sort process:

1. Compare the first two elements: if out of order, swap.
2. Compare the last two elements: if out of order, swap.
3. Repeat as necessary.

The FSM's directed graph would have six nodes, one for each permutation. Edges connect states where a single comparison and possible swap leads from one permutation to another. The input to each transition is the result of a comparison and the consequent swap action.

A simplified representation might be:

– State S1: [a, b, c] (initial)
– State S2: [b, a, c] – State S3: [b, c, a] – State S4: [c, b, a] – State S5: [a, c, b] – State S6: [c, a, b]

The transitions (edges) represent the result of comparing and swapping adjacent elements as per the bubble sort logic. The sorted state(s) ([a, b, c]) would be marked as accepting or final.

FSM Limitations for Arbitrary-Length Sorting

While this approach works for a fixed-size list, it becomes impractical as the list size grows. For a list of n elements, there are n! possible permutations, so the size of the FSM (number of states) grows factorially with n. This exponential blowup in state space makes FSM representations infeasible for larger lists.

Additionally, standard FSMs are incapable of handling inputs of unbounded length where the state must encode arbitrary positions or values. Sorting algorithms, as typically implemented, use pointers, indices, or stacks—all forms of memory beyond FSM capabilities.

Augmented FSMs: Pushdown Automata and Turing Machines

To accommodate sorting on arbitrary-length lists, more powerful computational models are required. Pushdown automata (PDAs), which augment FSMs with a stack, are still insufficient for general sorting, as they can only store data in a last-in, first-out manner. Turing machines, which possess an unbounded tape, can implement general sorting algorithms.

FSMs in Practice: Didactic Value

Modeling a simple sorting algorithm as an FSM for small, fixed-size lists is didactically valuable. It teaches the student how computational processes can be broken down into states and transitions, and demonstrates the limitations of FSMs. This exercise illustrates the distinction between regular and non-regular computations, and why FSMs are powerful for protocol modeling but not for algorithms requiring memory proportional to input size.

From a security and complexity theory perspective, understanding the bounds of FSMs helps clarify why certain operations (such as protocol validation or simple pattern matching) are computationally efficient and realizable in hardware or firmware, while other operations (like general-purpose computation or complex parsing) require more sophisticated models.

Directed Graph Construction: Step-by-Step

To construct the directed graph for a sorting FSM (for a fixed-length list):

1. Enumerate all possible permutations of the input list. Each permutation is a state.
2. For each state, identify the possible transitions resulting from applying the sorting algorithm's step (e.g., comparing and swapping adjacent elements).
3. Draw directed edges from each state to the resulting state(s) after an operation.
4. Identify the start state (the initial permutation).
5. Identify the accepting state(s) (the sorted permutation(s)).

Example Visualization

For the three-element list ([a, b, c]), the FSM would have states:

– s1: [a, b, c] – s2: [a, c, b] – s3: [b, a, c] – s4: [b, c, a] – s5: [c, a, b] – s6: [c, b, a]

Sample transitions (edges) might be:

– s1 –swap(2nd,3rd)–> s2
– s1 –swap(1st,2nd)–> s3
– s2 –swap(1st,2nd)–> s5
– s3 –swap(2nd,3rd)–> s4
– …and so forth.

The edges are labeled by the operation (which elements are compared/swapped). Once the FSM reaches s1 ([a, b, c]), no further swaps are needed; this state is accepting.

Key Takeaways

– Simple sorting algorithms, when applied to fixed-size input, can be modeled as FSMs, with each permutation as a state and transitions representing algorithmic steps.
– The directed graph of such an FSM is factorial in size with respect to the number of elements, making it impractical for large n.
– FSMs cannot implement general sorting for arbitrary-length lists due to their lack of auxiliary memory.
– A directed graph is a natural way to visualize the FSM, with vertices as states and directed edges as transitions.
– This modeling exercise serves as a valuable pedagogical tool for understanding the computational boundaries of FSMs and the need for more powerful models in general algorithmic computation.

Other recent questions and answers regarding Introduction to Finite State Machines:

  • Can virtual machines be considered as FSMs?
  • Can a DFSM repeat without any randomness?
  • What is perfect repeatability in DFSM
  • For deterministic finite state machine no randomness means perfect
  • How to represent OR as FSM?
  • What is the relationship between FSMs, regular languages, and regular expressions?
  • How does an FSM determine whether a string is accepted or rejected?
  • What is the purpose of the initial state in an FSM?
  • How are FSMs represented graphically?
  • What is the key aspect of a finite state machine (FSM) in terms of its memory?

More questions and answers:

  • Field: Cybersecurity
  • Programme: EITC/IS/CCTF Computational Complexity Theory Fundamentals (go to the certification programme)
  • Lesson: Finite State Machines (go to related lesson)
  • Topic: Introduction to Finite State Machines (go to related topic)
Tagged under: Computational Models, Cybersecurity, Finite State Automata, Regular Languages, Sorting Algorithms, State Transition Diagram
Home » Cybersecurity » EITC/IS/CCTF Computational Complexity Theory Fundamentals » Finite State Machines » Introduction to Finite State Machines » » Can a simple sorting algorithm be considered as an FSM? If yes, how could we represent it with a directed graph?

Certification Center

USER MENU

  • My Account

CERTIFICATE CATEGORY

  • EITC Certification (105)
  • EITCA Certification (9)

What are you looking for?

  • Introduction
  • How it works?
  • EITCA Academies
  • EITCI DSJC Subsidy
  • Full EITC catalogue
  • Your order
  • Featured
  •   IT ID
  • EITCA reviews (Medium publ.)
  • About
  • Contact

EITCA Academy is a part of the European IT Certification framework

The European IT Certification framework has been established in 2008 as a Europe based and vendor independent standard in widely accessible online certification of digital skills and competencies in many areas of professional digital specializations. The EITC framework is governed by the European IT Certification Institute (EITCI), a non-profit certification authority supporting information society growth and bridging the digital skills gap in the EU.
Eligibility for EITCA Academy 90% EITCI DSJC Subsidy support
90% of EITCA Academy fees subsidized in enrolment

    EITCA Academy Secretary Office

    European IT Certification Institute ASBL
    Brussels, Belgium, European Union

    EITC / EITCA Certification Framework Operator
    Governing European IT Certification Standard
    Access contact form or call +32 25887351

    Follow EITCI on X
    Visit EITCA Academy on Facebook
    Engage with EITCA Academy on LinkedIn
    Check out EITCI and EITCA videos on YouTube

    Funded by the European Union

    Funded by the European Regional Development Fund (ERDF) and the European Social Fund (ESF) in series of projects since 2007, currently governed by the European IT Certification Institute (EITCI) since 2008

    Information Security Policy | DSRRM and GDPR Policy | Data Protection Policy | Record of Processing Activities | HSE Policy | Anti-Corruption Policy | Modern Slavery Policy

    Automatically translate to your language

    Terms and Conditions | Privacy Policy
    EITCA Academy
    • EITCA Academy on social media
    EITCA Academy


    © 2008-2026  European IT Certification Institute
    Brussels, Belgium, European Union

    TOP
    CHAT WITH SUPPORT
    Do you have any questions?
    We will reply here and by email. Your conversation is tracked with a support token.