Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

Introduction to Queue Automata

  • Last Updated : 08 Jul, 2020

We already know about Finite Automata which can be used to accept regular languages and Pushdown Automata that can be used to recognize Context Free Languages.

Queue Automata(QDA) is a non-deterministic automata that is similar to Pushdown Automata but has a queue instead of a stack which helps Queue automata to recognize languages beyond Context Free Languages. 

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.


A QDA is a 6 – tuple M = (Q, \sigma, \Gamma, \delta, q_0, F)


  1. Q is the set of finite states.
  2. \bf{\sigma} is the set of finite input alphabets.
  3. \bf{\Gamma} is the set of finite queue alphabets.
  4. \delta : Q \times \sigma_\epsilon \times \Gamma_\epsilon \rightarrow P(Q \times \Gamma_\epsilon ).
  5. q_0 \in Q is the start state.
  6. F \subseteq Q is the set of accept states.

Acceptance of a string

A QDA M = (Q, \sigma, \Gamma, \delta, q_0, F) accepts input w if w can be written as w= w_1w_2w_3 ... . w_m, where each w_i \in \sigma_\epsilon and there are states r_0, r_1, r_2, ... . ., r_m \in Q and strings s_0, s_1, s_2, ... . ., s_m \in \Gamma^* exist, such that they satisfy the following conditions:

  1. r_0 = q_0 and s_0 = \epsilon.
  2. For 0\leq i \leq m-1 ( r_{i+1}, b) = \delta(r_i, w_{i+1}, a), where\, a, b \in \Gamma_\epsilon and s_i = ta and s_{i+1} = bt and t \in \Gamma^*
  3. r_m \in F

Define the queue automata for language {a^nb^n | n \geq 0}

Q = {q0, q1, q2, q3} and \sigma={a, b} and \Gamma = {a, b, $}
And the transition functions are given by:
\delta(q0, a, \epsilon)={(q0, a)}
\delta(q0, \epsilon, \epsilon)={(q1, \$)}
\delta(q1, \epsilon, a)={(q2, \epsilon)}
\delta(q2, \epsilon, a)={(q2, a)}
\delta(q2, b, \$)={(q1, \$)}
\delta(q1, \epsilon, \$)={(q3, \$)}

Let us see how this automata works for aabb.

RowStateInputTransition functionQueue(Input from left)State after move
1q0aabbδ(q0, a, ε)={(q0, a)}aq0
2q0aabbδ(q0, a, ε)={(q0, a)}aaq0
3q0εδ(q0, ε, ε)={(q1, $)}$aaq1
4q1εδ(q1, ε, a)={(q2, ε)}$aq2
5q2εδ(q2, ε, a)={(q2, a)}a$q2
6q2aabbδ(q2, b, $)={(q1, $)}$aq1
7q1εδ(q1, ε, a)={(q2, ε)}$q2
8q2aabbδ(q2, b, $)={(q1, $)}$q1
9q1εδ(q1, ε, $)={(q3, $)}$q3

My Personal Notes arrow_drop_up
Recommended Articles
Page :