Week 1 Lecture 2 - DFAs and NDFAs

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards

How is a deterministic finite state automata specified?

M = ⟨Q, Σ, δ, i, F⟩ where:

→ Q, a finite set of states
→ Σ, a finite set of possible input symbols, the alphabet → δ, a transition function Q × Σ → Q
→ i, an initial state (i ∈ Q)
→ F , a set of final states (F ⊆ Q)

2
New cards

Defining acceptance in a DFA

knowt flashcard image
3
New cards

When is a non empty string S accepted by a DFA?

knowt flashcard image
4
New cards

When is the empty string λ accepted by a DFA?

knowt flashcard image
5
New cards

When is a language L accepted by an FSA (DFA)

iff M accepts every string S in L and nothing else

6
New cards

Construct the DFA for the following language:

L = {w | w has an even number of 0s and an even number of 1s

The (minimum) job of the states of this DFA is to assess the parity of 0s and 1s.
Hence a four state machine:
• q0 — even 0s and even 1s.
• q1 — odd 0s and even 1s.
• q2 — even 0s and odd 1s.
• q3 — odd 0s and odd 1s.

<p><span style="font-size: calc(var(--scale-factor)*10.91px)">The (minimum) job of the states of this DFA is to assess the parity of 0s and 1s.</span><br><span style="font-size: calc(var(--scale-factor)*10.91px)">Hence a four state machine:</span><br><span style="font-size: calc(var(--scale-factor)*9.96px)">• q</span><span style="font-size: calc(var(--scale-factor)*6.97px)">0 </span><span style="font-size: calc(var(--scale-factor)*9.96px)">— even 0s and even 1s.</span><br><span style="font-size: calc(var(--scale-factor)*9.96px)">• q</span><span style="font-size: calc(var(--scale-factor)*6.97px)">1 </span><span style="font-size: calc(var(--scale-factor)*9.96px)">— odd 0s and even 1s.</span><br><span style="font-size: calc(var(--scale-factor)*9.96px)">• q</span><span style="font-size: calc(var(--scale-factor)*6.97px)">2 </span><span style="font-size: calc(var(--scale-factor)*9.96px)">— even 0s and odd 1s.</span><br><span style="font-size: calc(var(--scale-factor)*9.96px)">• q</span><span style="font-size: calc(var(--scale-factor)*6.97px)">3 </span><span style="font-size: calc(var(--scale-factor)*9.96px)">— odd 0s and odd 1s.</span><br></p>
7
New cards
<p>What is the difference between the languages accepted by the following DFAs?</p>

What is the difference between the languages accepted by the following DFAs?

q3 is known as a junk state (or sink, or dead). It is often omitted.

8
New cards
<p>Stack the transition labels on the pairs of stacks in this DFA</p>

Stack the transition labels on the pairs of stacks in this DFA

knowt flashcard image
9
New cards

What restriction does an NDFA (non-deterministic finite-state automa relax?

In a DFA, for every state there is one next state. In an NDFA, there can be multiple.

10
New cards
<p>How is this an example of an NDFA?</p>

How is this an example of an NDFA?

At q1 , there is a self loop for (a) but it also passes on to q2 (the accepting state). Because there are 2 transitions for a, it is an NDFA.

11
New cards
<p>How is this an example of an NDFA, and would it accept ‘11’? </p>

How is this an example of an NDFA, and would it accept ‘11’?

The input on q0 of the empty string means that if you have a string like ‘11’, even though it will end up at q2 , because the transition requires no input, it is still accepted.

Because of the λ transition, it is an NDFA.

12
New cards

Advantages of non-determinism:

→ Problems involving search can be expressed more neatly using NDFA.

→ Applying algorithms to create or modify FSA, the results are sometimes non-deterministic.