SlideShare a Scribd company logo
This algorithm was coined out by Knuth, Morris and
Pratt. It is a linear time string-matching algorithm.
Text
Pattern
Now by comparing the text with the pattern
Text
Pattern
Text
Pattern
 Here is a match. And the substring search will return index number 0.
 Now compare only the fourth 1 of the pattern with the fourth character of the text.
 As it is already known that the first three characters will already match and hence
skip the first three characters of the pattern while matching.
Hey Friends,
This was just a summary on Knuth–Morris–Pratt algorithm. For more
detailed information on this topic, please type the link given below or copy it
from the description of this PPT and open it in a new browser window.
http://www.transtutors.com/homework-help/computer-science/knuth-marris-
pratt-algorithm.aspx

More Related Content

PPTX
String Match | Computer Science
PPTX
Naive string matching
PPTX
Artificial Intelligence
DOCX
Energy-Efficient TCAM Search Engine Design Using Priority-Decision in Memory ...
PPT
Argumentation Trails and Topic Maps
PPT
Paper
PPTX
Splay tree && euler tour tree
PPTX
Splay Trees and Self Organizing Data Structures
String Match | Computer Science
Naive string matching
Artificial Intelligence
Energy-Efficient TCAM Search Engine Design Using Priority-Decision in Memory ...
Argumentation Trails and Topic Maps
Paper
Splay tree && euler tour tree
Splay Trees and Self Organizing Data Structures

Viewers also liked (15)

PDF
06. string matching
PPT
KMP Pattern Matching algorithm
PDF
Masterizing php data structure 102
PPT
Stack a Data Structure
PPTX
Stack Data structure
PPT
Stack Data Structure & It's Application
PPT
Queue Data Structure
PDF
Queue as data_structure
PDF
Applications of stack
PPTX
Tree in data structure
PDF
Tree and binary tree
PPT
Queue data structure
PPT
Splay tree
PPTX
Trees data structure
06. string matching
KMP Pattern Matching algorithm
Masterizing php data structure 102
Stack a Data Structure
Stack Data structure
Stack Data Structure & It's Application
Queue Data Structure
Queue as data_structure
Applications of stack
Tree in data structure
Tree and binary tree
Queue data structure
Splay tree
Trees data structure
Ad

Similar to Knuth–Morris–Pratt Algorithm | Computer Science (20)

PPT
PDF
String matching algorithms
PPTX
Gp 27[string matching].pptx
PDF
PPTX
Advance algorithms in master of technology
PPTX
String matching Algorithm by Foysal
PPTX
String matching algorithms-pattern matching.
PPTX
IMPLEMENTATION OF DIFFERENT PATTERN RECOGNITION ALGORITHM
PPTX
Knuth morris pratt string matching algo
PPT
PatternMatching2.pptnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
PDF
StringMatching-Rabikarp algorithmddd.pdf
PPTX
String matching algorithms
PDF
module6_stringmatchingalgorithm_2022.pdf
PPTX
String Matching Algorithms-The Naive Algorithm
DOC
4 report format
DOC
4 report format
PPTX
String Matching Finite Automata & KMP Algorithm.
PDF
String matching, naive,
PPT
Chpt9 patternmatching
PPT
String matching algorithm
String matching algorithms
Gp 27[string matching].pptx
Advance algorithms in master of technology
String matching Algorithm by Foysal
String matching algorithms-pattern matching.
IMPLEMENTATION OF DIFFERENT PATTERN RECOGNITION ALGORITHM
Knuth morris pratt string matching algo
PatternMatching2.pptnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
StringMatching-Rabikarp algorithmddd.pdf
String matching algorithms
module6_stringmatchingalgorithm_2022.pdf
String Matching Algorithms-The Naive Algorithm
4 report format
4 report format
String Matching Finite Automata & KMP Algorithm.
String matching, naive,
Chpt9 patternmatching
String matching algorithm
Ad

More from Transweb Global Inc (20)

PPTX
Resultant of Coplanar Parallel Forces | Mechanical Engineering
PPTX
The Centroidal Axis | Mechanical Engineering
PPTX
System Of Coplanar Forces | Mechanical Engineering
PPTX
Resultant of Two Unlike and Unequal Parallel Forces | Mechanical Engineering
PPTX
SFD Load Diagram Examples | Mechanical Engineering
PPTX
Principle Of Transmissibility | Mechanical Engineering
PPTX
Law Of Polygon | Mechanical Engineering
PPTX
Similarities between Leadership and Management | Management
PPTX
Ranked Positional Weight Method | Management
PPTX
Business Intelligence And Business Analytics | Management
PPTX
ABC Cost Hierarchy | Management
PPTX
Speed To Market | Management
PPTX
Managerial Hubris | Finance
PPTX
Conductance | Electrical Engineering
PPTX
Advantages and Disadvantages of Digital Electronics | Electrical Engineering
PPTX
Stabilization Of Operating Point | Electrical Engineering
PPTX
Offer Curves | Economics
PPTX
Fixed Exchange Rate | Economics
PPTX
Computer Architecture | Computer Science
PPTX
Compilers Computer Program | Computer Science
Resultant of Coplanar Parallel Forces | Mechanical Engineering
The Centroidal Axis | Mechanical Engineering
System Of Coplanar Forces | Mechanical Engineering
Resultant of Two Unlike and Unequal Parallel Forces | Mechanical Engineering
SFD Load Diagram Examples | Mechanical Engineering
Principle Of Transmissibility | Mechanical Engineering
Law Of Polygon | Mechanical Engineering
Similarities between Leadership and Management | Management
Ranked Positional Weight Method | Management
Business Intelligence And Business Analytics | Management
ABC Cost Hierarchy | Management
Speed To Market | Management
Managerial Hubris | Finance
Conductance | Electrical Engineering
Advantages and Disadvantages of Digital Electronics | Electrical Engineering
Stabilization Of Operating Point | Electrical Engineering
Offer Curves | Economics
Fixed Exchange Rate | Economics
Computer Architecture | Computer Science
Compilers Computer Program | Computer Science

Recently uploaded (20)

PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PDF
Insiders guide to clinical Medicine.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Business Ethics Teaching Materials for college
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Pharma ospi slides which help in ospi learning
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Open folder Downloads.pdf yes yes ges yes
PPTX
Introduction and Scope of Bichemistry.pptx
PDF
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
Module 3: Health Systems Tutorial Slides S2 2025
Insiders guide to clinical Medicine.pdf
Anesthesia in Laparoscopic Surgery in India
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Business Ethics Teaching Materials for college
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Pharma ospi slides which help in ospi learning
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
COMPUTERS AS DATA ANALYSIS IN PRECLINICAL DEVELOPMENT.pptx
O7-L3 Supply Chain Operations - ICLT Program
Open folder Downloads.pdf yes yes ges yes
Introduction and Scope of Bichemistry.pptx
Electrolyte Disturbances and Fluid Management A clinical and physiological ap...
human mycosis Human fungal infections are called human mycosis..pptx

Knuth–Morris–Pratt Algorithm | Computer Science

  • 1. This algorithm was coined out by Knuth, Morris and Pratt. It is a linear time string-matching algorithm.
  • 2. Text Pattern Now by comparing the text with the pattern Text Pattern
  • 3. Text Pattern  Here is a match. And the substring search will return index number 0.  Now compare only the fourth 1 of the pattern with the fourth character of the text.  As it is already known that the first three characters will already match and hence skip the first three characters of the pattern while matching.
  • 4. Hey Friends, This was just a summary on Knuth–Morris–Pratt algorithm. For more detailed information on this topic, please type the link given below or copy it from the description of this PPT and open it in a new browser window. http://www.transtutors.com/homework-help/computer-science/knuth-marris- pratt-algorithm.aspx