SlideShare a Scribd company logo
1 of 242
12/28/2022 1
RAJALAKSHMI ENGINEERING
COLLEGE
12/28/2022 2
UNIT- I
AUTOMATA
12/28/2022 3
12/28/2022 4
12/28/2022 5
12/28/2022 6
12/28/2022 7
12/28/2022 8
12/28/2022 9
12/28/2022 10
12/28/2022 11
12/28/2022 12
12/28/2022 13
12/28/2022 14
12/28/2022 15
Finite Automata
12/28/2022 16
12/28/2022 17
 States
Open
Closed
 Sensors
Front – Someone on the Front pad
Rear – Someone on the Rear pad
Both – Someone on both the pads
Neither – No one on either pad
12/28/2022 18
12/28/2022 19
12/28/2022 20
12/28/2022 21
12/28/2022 22
12/28/2022 23
12/28/2022 24
12/28/2022 25
12/28/2022 26
12/28/2022 27
12/28/2022 28
12/28/2022 29
12/28/2022 30
12/28/2022 31
12/28/2022 32
12/28/2022 33
12/28/2022 34
12/28/2022 35
12/28/2022 36
12/28/2022 37
12/28/2022 38
12/28/2022 39
12/28/2022 40
12/28/2022 41
UNIT - II
REGULAR EXPRESSIONS
AND
LANGUAGES
12/28/2022 42
12/28/2022 43
12/28/2022 44
12/28/2022 45
12/28/2022 46
12/28/2022 47
12/28/2022 48
12/28/2022 49
12/28/2022 50
12/28/2022 51
12/28/2022 52
12/28/2022 53
12/28/2022 54
12/28/2022 55
12/28/2022 56
12/28/2022 57
12/28/2022 58
12/28/2022 59
12/28/2022 60
12/28/2022 61
12/28/2022 62
12/28/2022 63
12/28/2022 64
12/28/2022 65
12/28/2022 66
12/28/2022 67
12/28/2022 68
12/28/2022 69
12/28/2022 70
12/28/2022 71
12/28/2022 72
12/28/2022 73
12/28/2022 74
12/28/2022 75
12/28/2022 76
12/28/2022 77
12/28/2022 78
12/28/2022 79
12/28/2022 80
Questions about Regular Languages
12/28/2022 81
Question contd…
12/28/2022 82
Singleton Languages are Regular
12/28/2022 83
Finite Languages are regular
12/28/2022 84
12/28/2022 85
12/28/2022 86
12/28/2022 87
12/28/2022 88
12/28/2022 89
Closure Properties for Regular Languages
12/28/2022 90
Myhill-Nerode Theorem
12/28/2022 91
12/28/2022 92
12/28/2022 93
12/28/2022 94
UNIT III
CONTEXT-FREE GRAMMAR
AND
LANGUAGES
12/28/2022 95
Context Free Grammars
12/28/2022 96
Cont…
12/28/2022 97
Cont…
12/28/2022 98
Defining CFG
12/28/2022 99
Notational conventions For CFGs
12/28/2022 100
OTHER CFG EXAMPLES
12/28/2022 101
Languages of CFG
12/28/2022 102
Languages of CFG
12/28/2022 103
Regular Languages and CFL
12/28/2022 104
Translating FAs into CFG
12/28/2022 105
Formalizing the Translation
12/28/2022 106
Closure Properties of CFL
12/28/2022 107
Proving CFLs closed under Union
12/28/2022 108
IDEA
12/28/2022 109
Formal Construction of Gu
12/28/2022 110
Derivations
12/28/2022 111
Sentential Form
12/28/2022 112
Left Most and Right Most Derivation
12/28/2022 113
Right-Linear Grammars
12/28/2022 114
Ambiguous Grammars
12/28/2022 115
Ambiguous Grammars
12/28/2022 116
Pushdown Automata
Recall our study of regular languages.
 They were defined in terms of regular expressions (syntax).
 We then showed that FAs provide the computational power
needed to process them.
We would like to mimic this line of development for CFLs.
 We have a “syntactic” definition of CFLs in terms of CFGs.
 What kind of computing power is needed to “process” (i.e.
recognize) CFLs?
Do FAs suffice?
12/28/2022 117
Cont…
12/28/2022 118
Cont…
12/28/2022 119
Example PDA for{0n1n|n≥0}
12/28/2022 120
Formal Definition
12/28/2022 121
Instantaneous Description
12/28/2022 122
Language accepted by PDA
12/28/2022 123
Language accepted by PDA
12/28/2022 124
Language accepted by PDA
12/28/2022 125
Equivalence of CFGs and PDAs
12/28/2022 126
Cont…
12/28/2022 127
Deterministic PDA
12/28/2022 128
UNIT - IV
PROPERTIES
OF
CONTEXT-FREE LANGUAGES
12/28/2022 129
Chomsky Normal Form
12/28/2022 130
Defining CNF
12/28/2022 131
What is the Big Deal about CNF?
12/28/2022 132
Cont…
12/28/2022 133
Converting CFGs into CNF
12/28/2022 134
Eliminating ε-Productions
12/28/2022 135
Cont…
12/28/2022 136
Cont…
12/28/2022 137
Nullability
12/28/2022 138
Generating an ε-Production-free CFGs
12/28/2022 139
Converting CFGs into CNF
12/28/2022 140
Eliminating Unit Productions
12/28/2022 141
Cont…
12/28/2022 142
U(G,A) and New Productions
12/28/2022 143
Example
12/28/2022 144
Cont…
12/28/2022 145
Formal Construction
12/28/2022 146
Eliminating Terminal Productions
12/28/2022 147
Example
12/28/2022 148
Formal Construction
12/28/2022 149
Pumping Lemma For CFLs
12/28/2022 150
Cont…
12/28/2022 151
Derivation Trees
12/28/2022 152
Defining Derivation Tree
12/28/2022 153
Example
12/28/2022 154
Derivation Trees and CNF
12/28/2022 155
12/28/2022 156
Pumping Lemma for CFL
12/28/2022 157
Proving Languages Non Context Free
using Pumping Lemma
12/28/2022 158
Prove that L= {aNbNcN|N ≥0} is Not a
CFL
12/28/2022 159
Proof Cont…
12/28/2022 160
Turing Machines
12/28/2022 161
A Finite Automaton
12/28/2022 162
A Pushdown Automaton
12/28/2022 163
A Turing Machine
12/28/2022 164
Cont..
12/28/2022 165
Differences
12/28/2022 166
Example
12/28/2022 167
Cont…
12/28/2022 168
Cont…
12/28/2022 169
Cont…
12/28/2022 170
Formal Definition
12/28/2022 171
Cont..
12/28/2022 172
Cont…
12/28/2022 173
Cont…
12/28/2022 174
Configurations
12/28/2022 175
Cont…
12/28/2022 176
More Configuration
12/28/2022 177
Accepting a Language
12/28/2022 178
Enumerable Languages
12/28/2022 179
UNIT – V
UNDECIDABILITY
12/28/2022 180
Enumerable Languages
12/28/2022 181
Enumerable Languages
12/28/2022 182
Example
12/28/2022 183
Example
12/28/2022 184
Example
12/28/2022 185
Element Distinctness
12/28/2022 186
Element Distinctness
12/28/2022 187
Element Distinctness
12/28/2022 188
Element Distinctness
12/28/2022 189
Element Distinctness
12/28/2022 190
Variants
12/28/2022 191
Multitape Turing Machine
12/28/2022 192
Equivalence
12/28/2022 193
Simulation
12/28/2022 194
Simulation
12/28/2022 195
Non Deterministic Turing Machine
12/28/2022 196
Decidability
12/28/2022 197
Example
12/28/2022 198
Theorem
12/28/2022 199
Theorem
12/28/2022 200
Theorem
12/28/2022 201
Theorem
12/28/2022 202
Halting Problem
12/28/2022 203
Cont..
12/28/2022 204
Cont..
12/28/2022 205
Turing Machines are countable
12/28/2022 206
Cont..
12/28/2022 207
Post Correspondence Problem
12/28/2022 208
Cont…
12/28/2022 209
Cont...
12/28/2022 210
Cont…
12/28/2022 211
Cont…
12/28/2022 212
Cont…
12/28/2022 213
12/28/2022 214
NP-complete Problem
12/28/2022 215
12/28/2022 216
12/28/2022 217
Decision Problems
To keep things simple, we will mainly concern ourselves with
decision problems. These problems only require a single bit output:
``yes'' and ``no''.
How would you solve the following decision problems?
Is this directed graph acyclic?
Is there a spanning tree of this undirected graph with total
weight less than w?
Does this bipartite graph have a perfect (all nodes matched)
matching?
Does the pattern p appear as a substring in text t?
12/28/2022 218
12/28/2022 219
P
P is the set of decision problems that can be solved in worst-case
polynomial time:
If the input is of size n, the running time must be O(nk).
Note that k can depend on the problem class, but not the
particular instance.
All the decision problems mentioned above are in P.
12/28/2022 220
Nice Puzzle
The class NP (meaning non-deterministic polynomial time) is the
set of problems that might appear in a puzzle magazine: ``Nice
puzzle.''
What makes these problems special is that they might be hard to
solve, but a short answer can always be printed in the back, and it
is easy to see that the answer is
correct once you see it.
Example... Does matrix A have an LU decomposition?
No guarantee if answer is ``no''.
12/28/2022 221
12/28/2022 222
NP
Technically speaking:
A problem is in NP if it has a short accepting certificate.
An accepting certificate is something that we can use to
quickly show that the answer is ``yes'' (if it is yes).
Quickly means in polynomial time.
Short means polynomial size.
This means that all problems in P are in NP (since we don't even
need a certificate to quickly show the answer is ``yes'').
But other problems in NP may not be in P. Given an integer x, is
it composite? How do we know this is in NP?
12/28/2022 223
Good Guessing
Another way of thinking of NP is it is the set of problems that can
solved efficiently by a really good guesser.
The guesser essentially picks the accepting certificate out of the air
(Non-deterministic Polynomial time). It can then convince itself that
it is correct using a polynomial
time algorithm. (Like a right-brain, left-brain sort of thing.)
Clearly this isn't a practically useful characterization: how could
we build such a machine?
12/28/2022 224
Exponential Upperbound
Another useful property of the class NP is that all NP problems can
be solved in exponential time (EXP).
This is because we can always list out all short certificates in
exponential time and check all O(2nk) of them.
Thus, P is in NP, and NP is in EXP. Although we know that P is
not equal to EXP, it is possible that NP = P, or EXP, or neither.
Frustrating!
12/28/2022 225
NP-hardness
As we will see, some problems are at least as hard to solve as any
problem in NP. We call such problems NP-hard.
How might we argue that problem X is at least as hard (to within
a polynomial factor) as problem Y?
If X is at least as hard as Y, how would we expect an algorithm
that is able to solve X to behave?
12/28/2022 226
12/28/2022 227
12/28/2022 228
12/28/2022 229
12/28/2022 230
One of the central (and widely and intensively studied 30 years)
problems of (theoretical) computer science is to prove that
(a) PNP (b) NP  co-NP.
All evidence indicates that these conjectures are true.
 Disproving any of these two conjectures would not only be
considered truly spectacular, but would also come as a tremendous
surprise (with a variety of far-reaching counterintuitive consequences).
NP-complete: Collection Z of problems is NP-complete if (a) it is NP
and (b) if polynomial-time algorithm existed for solving problems in Z,
then P=NP.
P
NP
co-NP
12/28/2022 231
12/28/2022 232
12/28/2022 233
12/28/2022 234
12/28/2022 235
12/28/2022 236
NP-Complete Problems
12/28/2022 237
12/28/2022 238
12/28/2022 239
12/28/2022 240
12/28/2022 241
12/28/2022 242

More Related Content

Similar to CS2303-TOC.pptx

Skiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completeSkiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np complete
zukun
 
GPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by AltenGPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by Alten
Arjan Somers
 

Similar to CS2303-TOC.pptx (10)

Algorithm Using Divide And Conquer
Algorithm Using Divide And ConquerAlgorithm Using Divide And Conquer
Algorithm Using Divide And Conquer
 
Daa unit 2
Daa unit 2Daa unit 2
Daa unit 2
 
Daa unit 2
Daa unit 2Daa unit 2
Daa unit 2
 
PGA: A Priority-aware Genetic Algorithm for Task Scheduling in Heterogeneous ...
PGA: A Priority-aware Genetic Algorithm for Task Scheduling in Heterogeneous ...PGA: A Priority-aware Genetic Algorithm for Task Scheduling in Heterogeneous ...
PGA: A Priority-aware Genetic Algorithm for Task Scheduling in Heterogeneous ...
 
Ki2518101816
Ki2518101816Ki2518101816
Ki2518101816
 
Ki2518101816
Ki2518101816Ki2518101816
Ki2518101816
 
Unit i
Unit iUnit i
Unit i
 
Skiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np completeSkiena algorithm 2007 lecture19 introduction to np complete
Skiena algorithm 2007 lecture19 introduction to np complete
 
GPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by AltenGPGPU Programming @DroidconNL 2012 by Alten
GPGPU Programming @DroidconNL 2012 by Alten
 
A Fast Near Optimal Vertex Cover Algorithm (NOVCA)
A Fast Near Optimal Vertex Cover Algorithm (NOVCA)A Fast Near Optimal Vertex Cover Algorithm (NOVCA)
A Fast Near Optimal Vertex Cover Algorithm (NOVCA)
 

Recently uploaded

Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
Kira Dess
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
BalamuruganV28
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
drjose256
 
electrical installation and maintenance.
electrical installation and maintenance.electrical installation and maintenance.
electrical installation and maintenance.
benjamincojr
 

Recently uploaded (20)

Artificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdfArtificial intelligence presentation2-171219131633.pdf
Artificial intelligence presentation2-171219131633.pdf
 
Final DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manualFinal DBMS Manual (2).pdf final lab manual
Final DBMS Manual (2).pdf final lab manual
 
Intro to Design (for Engineers) at Sydney Uni
Intro to Design (for Engineers) at Sydney UniIntro to Design (for Engineers) at Sydney Uni
Intro to Design (for Engineers) at Sydney Uni
 
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdfInvolute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
Involute of a circle,Square, pentagon,HexagonInvolute_Engineering Drawing.pdf
 
Adsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) pptAdsorption (mass transfer operations 2) ppt
Adsorption (mass transfer operations 2) ppt
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
Augmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptxAugmented Reality (AR) with Augin Software.pptx
Augmented Reality (AR) with Augin Software.pptx
 
History of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & ModernizationHistory of Indian Railways - the story of Growth & Modernization
History of Indian Railways - the story of Growth & Modernization
 
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
Tembisa Central Terminating Pills +27838792658 PHOMOLONG Top Abortion Pills F...
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
 
Dynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptxDynamo Scripts for Task IDs and Space Naming.pptx
Dynamo Scripts for Task IDs and Space Naming.pptx
 
Raashid final report on Embedded Systems
Raashid final report on Embedded SystemsRaashid final report on Embedded Systems
Raashid final report on Embedded Systems
 
21scheme vtu syllabus of visveraya technological university
21scheme vtu syllabus of visveraya technological university21scheme vtu syllabus of visveraya technological university
21scheme vtu syllabus of visveraya technological university
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference Modal
 
electrical installation and maintenance.
electrical installation and maintenance.electrical installation and maintenance.
electrical installation and maintenance.
 
handbook on reinforce concrete and detailing
handbook on reinforce concrete and detailinghandbook on reinforce concrete and detailing
handbook on reinforce concrete and detailing
 
Passive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.pptPassive Air Cooling System and Solar Water Heater.ppt
Passive Air Cooling System and Solar Water Heater.ppt
 
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdfInstruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
Instruct Nirmaana 24-Smart and Lean Construction Through Technology.pdf
 
Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...
 

CS2303-TOC.pptx