SlideShare a Scribd company logo
By:
P.Joshna rani
16031D7902
Native string matching algorithm:
 It has no pre-processing
phase, needs constant extra space. It always shifts the window by
exactly one position to the right.
 It requires 2n expected text characters comparisons.
 It finds all valid shifts using a loop that checks the condition
P[1....m]=T[s+1........s+m] for each of the n-m+1 possible values of s .
 Consider the following example.
 T=ANPANMAN
 P=MAN
 ANPANMAN
 Iterate through the input and the pattern at the same time, comparing
their characters to each other.
 Whenever you get a non-matching character between the two, you can
just reset the pattern position and keep the input position as is.
 This works because the pattern characters are all different, which means
that whenever you have a partial match, there can be no other match
overlapping with that, so we can just start looking from the end of the
partial match.
Naive string search
 Naive string matching algorithm takes time O((n-m+1)m), and this
bound is tight in the worst case.
 The worst case running time is thus O((n-m+1)m).
 The running time of Naive String Matching algorithm is equal to
its matching time, since there is no preprocessing.
Conclusion:
 String matching has greatly influenced the field of
computer science and will play an important role in future
technology.
 The importance of memory and time efficient string matching
algorithm will be increased in computer science.
 There are many more possible areas in which string matching can
play a key role for excelling.
 Innovation and creativity in string matching can play a immense
role for getting time efficient performance in various domains of
computer science.
Thank you

More Related Content

PPT
Calc 3.8
PPT
Three forces-system
PPTX
Recurrent Neuron Network-from point of dynamic system & state machine
PPTX
Applications of Z transform
PDF
Turing machine seminar report
PPTX
REVISION- UNIT 2 -ANALYSIS OF CONTINUOUS TIME SIGNALS
PPTX
Limit of a function
PPT
Turing Machine
Calc 3.8
Three forces-system
Recurrent Neuron Network-from point of dynamic system & state machine
Applications of Z transform
Turing machine seminar report
REVISION- UNIT 2 -ANALYSIS OF CONTINUOUS TIME SIGNALS
Limit of a function
Turing Machine

Viewers also liked (9)

PPTX
String Match | Computer Science
PPT
KMP Pattern Matching algorithm
PPTX
Rabin karp string matching algorithm
PDF
String matching algorithms
PPTX
String matching algorithms
PPTX
Boyer–Moore string search algorithm
PPTX
Naive Bayes Presentation
PPTX
Naive bayes
PPT
String matching algorithm
String Match | Computer Science
KMP Pattern Matching algorithm
Rabin karp string matching algorithm
String matching algorithms
String matching algorithms
Boyer–Moore string search algorithm
Naive Bayes Presentation
Naive bayes
String matching algorithm
Ad

Similar to Naive string search (20)

PDF
String matching, naive,
DOC
4 report format
DOC
4 report format
PPT
Naive String Matching Algorithm | Computer Science
PPTX
Naive string matching
PPTX
Advance algorithms in master of technology
PPTX
Gp 27[string matching].pptx
PDF
06. string matching
PDF
Naive string matching algorithm
PPTX
String Matching (Naive,Rabin-Karp,KMP)
PPTX
String Matching Algorithms-The Naive Algorithm
PDF
Data Representation of Strings
PPTX
String Matching Algorithms: Naive, KMP, Rabin-Karp
PPTX
String_Matching_algorithm String_Matching_algorithm .pptx
PDF
Daa chapter9
PDF
Buacm 2
PPTX
IMPLEMENTATION OF DIFFERENT PATTERN RECOGNITION ALGORITHM
PPT
String matching algorithms
PDF
25 String Matching
PPTX
String matching Algorithm by Foysal
String matching, naive,
4 report format
4 report format
Naive String Matching Algorithm | Computer Science
Naive string matching
Advance algorithms in master of technology
Gp 27[string matching].pptx
06. string matching
Naive string matching algorithm
String Matching (Naive,Rabin-Karp,KMP)
String Matching Algorithms-The Naive Algorithm
Data Representation of Strings
String Matching Algorithms: Naive, KMP, Rabin-Karp
String_Matching_algorithm String_Matching_algorithm .pptx
Daa chapter9
Buacm 2
IMPLEMENTATION OF DIFFERENT PATTERN RECOGNITION ALGORITHM
String matching algorithms
25 String Matching
String matching Algorithm by Foysal
Ad

Recently uploaded (20)

PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Construction Project Organization Group 2.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
additive manufacturing of ss316l using mig welding
PDF
PPT on Performance Review to get promotions
PPTX
Geodesy 1.pptx...............................................
PDF
composite construction of structures.pdf
PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
bas. eng. economics group 4 presentation 1.pptx
Construction Project Organization Group 2.pptx
Mechanical Engineering MATERIALS Selection
III.4.1.2_The_Space_Environment.p pdffdf
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
R24 SURVEYING LAB MANUAL for civil enggi
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
UNIT 4 Total Quality Management .pptx
additive manufacturing of ss316l using mig welding
PPT on Performance Review to get promotions
Geodesy 1.pptx...............................................
composite construction of structures.pdf
Fundamentals of safety and accident prevention -final (1).pptx
Internet of Things (IOT) - A guide to understanding
CH1 Production IntroductoryConcepts.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf

Naive string search

  • 2. Native string matching algorithm:  It has no pre-processing phase, needs constant extra space. It always shifts the window by exactly one position to the right.  It requires 2n expected text characters comparisons.  It finds all valid shifts using a loop that checks the condition P[1....m]=T[s+1........s+m] for each of the n-m+1 possible values of s .  Consider the following example.  T=ANPANMAN  P=MAN  ANPANMAN
  • 3.  Iterate through the input and the pattern at the same time, comparing their characters to each other.  Whenever you get a non-matching character between the two, you can just reset the pattern position and keep the input position as is.  This works because the pattern characters are all different, which means that whenever you have a partial match, there can be no other match overlapping with that, so we can just start looking from the end of the partial match.
  • 5.  Naive string matching algorithm takes time O((n-m+1)m), and this bound is tight in the worst case.  The worst case running time is thus O((n-m+1)m).  The running time of Naive String Matching algorithm is equal to its matching time, since there is no preprocessing.
  • 6. Conclusion:  String matching has greatly influenced the field of computer science and will play an important role in future technology.  The importance of memory and time efficient string matching algorithm will be increased in computer science.  There are many more possible areas in which string matching can play a key role for excelling.  Innovation and creativity in string matching can play a immense role for getting time efficient performance in various domains of computer science.