620

# Finite Automata and Regular Languages January 27, 2014

## Transcript

1. ### F I N I T E & R E G

U L A R A U T O M A T A L A N G U A G E S @tomstuart / London JS / 2014-01-27

b

a b bb aa 1

b bb aa 2 1

a b bb aa 2

b bb aa 3 2

a b bb aa 3

a b bb aa 3

b bb aa 3 2

b

a b bb aa 1

b bb aa 2 1

a b bb aa 2

b bb aa 3 2

a b bb aa 3

a b bb aa 3

b bb aa 3 2

27. ### 1 3 a b b , a a b a

b bb aa 3 2 ✔

b

a b b b bb 1

a b b b bb b

a b b b bb b

a b b b bb b

a b b b bb 2

a b b b bb 2

a b b b bb 2
36. ### a a 1 2 3 a b b , a

a b b b bb ✘ 2
37. ### bbbbaa baabba ✔ ✘ ab baba aaaab a baaaa b

bbbbbb abbbb bbbbab bba ✔ ✔ ✔ ✔ ✔ ✘ ✘ ✘ ✘ ✘

1

2

3
41. ### 1 2 3 a b b , a a b

accepts strings containing "ab"

a,b

three

a

53. ### but there's an algorithm to convert any nondeterministic ﬁnite automaton

into a deterministic one

55. ### 1 1,2,4 1,3,4 1,3 b a a 1,2 1,4 1,2,3,4

1,2,3 b a b a b b a b a b a b a

58. ### bbbbaa baabba ✔ ✘ ab baba aaaab a baaaa b

bbbbbb abbbb bbbbab bba ✔ ✔ ✔ ✔ ✔ ✘ ✘ ✘ ✘ ✘
59. ### baabba ab baba aaaab abbbb bbbbab this is part of

the language that the machine recognises

62. ### some regular languages: • the strings "one", "two" and "three"

• all strings that contain "ab" • all strings whose third character is "b" • all strings whose third-from-last character is "b" • all strings that start and end with "a"
63. ### some non-regular languages: • all strings that are palindromes •

all strings that contain equal numbers of "a" and "b" characters • all strings of brackets that are balanced • all strings that are valid JSON • all strings that contain equal numbers of "a", "b" and "c" characters • all strings whose length is prime • all strings that contain a halting JavaScript program
64. ### ( () ✔ ✘ (()) (()(())) ()()()()() (( (() )

(((())))) ((((())))) (()((()))) (()))() ✔ ✔ ✔ ✔ ✔ ✘ ✘ ✘ ✘ ✘

81. None
82. None

102. None

107. None

automaton

expression

141. None
142. None

\z /x