string matching algorithms

20
STRING MATCHING ALGORITHMS Google images

Upload: department-of-computer-science-university-of-peshawar

Post on 14-Jul-2015

243 views

Category:

Science


3 download

TRANSCRIPT

STRING MATCHING ALGORITHMS

Google images

OUTLINE

What is String?

What is String Matching?

Definition of Algorithm

String Matching Algorithms

String Matching Algorithms Applications

WHAT IS STRING?

In computer programming, a string is traditionally a

sequence of characters, either as constant or as

some kind of variable

E.g. ABCABDC or 1Ac35D

Google images

WHAT IS STRING?

String may be applied in Bioinformatics to describe

DNA strand composed of nitrogenous bases

Google images

WHAT IS STRING MATCHING?

String matching is finding occurrence(s) of a pattern

string within another string or body of text

E.g. We have a string “BCATDOG” and the pattern

to be searched is “CAT”. Now finding “CAT” in the

string “BCATDOG” is string matching

WHAT IS STRING MATCHING?

Uses for the string matching include:

Finding a text in a document file or in a report

Used by different search engines like: Google

Google images

EXAMPLE

Google images

DEFINITION OF ALGORITHM

Algorithm is formula or set of rules followed for

solving a problem.

Example: Searching algorithms, sorting algorithms,

etc.

Google images

Example: Algorithm for checking a lamp

Google images

STRING MATCHING ALGORITHMS

Brute Force Algorithm

Karp-Rabin Algorithm

Boyer-Moore Algorithm

BRUTE FORCE ALGORITHM

Simplest string matching algorithm

Steps:

Match the first character of the pattern with the first

character of the string

If succeed, try to match the second character, and then

third and so on

BRUTE FORCE ALGORITHM

If hit a failure point, slide the pattern over one character

and try again

When a match is found, return its starting location

Example:

Given string “BCCATDOG”

Pattern to match is “CAT”

EXAMPLE

ALGORITHM FOR EXAMPLE

Step1: Match the first character of the pattern with the first character of the string

Step3: If hit a failure point, slide the pattern over one character and try again

Step2: If succeed, try to match the next character, and so on

Step4: When a match is found, return its starting location

Starting location for the pattern in the string is “3”

STRING MATCHING ALGORITHMS

APPLICATIONS

Besides Computer Science, String matching

algorithms have some other applications:

Detecting Plagiarism:

it is the process of locating instances of

plagiarism within a work or document

Bioinformatics

String algorithms are centrally important in

bioinformatics for dealing with sequence

information

CONT.

Molecular biology

Approximate matching of a search pattern to

a target text is a fundamental tool in

molecular biology

Computer Science

Exact string matching is more useful in

computer science

CONT.

Text Mining Research:

includes information extraction, topic

tracking, content summarization, information

visualization, question answering, concept

linkage, text classification, and text clustering

Google images

Google images

CONTACT ME

If you want the resources and further understanding

on this topic contact me via my email:

[email protected]

Copy, cut do anything you want!!