Strings 2008 2 3: Difference between revisions

From MDWiki
Jump to navigationJump to search
No edit summary
 
No edit summary
Line 1: Line 1:
== Brute force (naive) search ==
== Brute force (naive) search ==


The simplest, but also least efficient approach to text searching is to check is the try out every possible combination in which the two strings can be
The simplest, but also least efficient approach to text searching is to check whether the pattern matches the string at every possible position in the string. This is called the brute-force or naive string search algorithm. The procedure is illustrated below.


=== Formalisation of the problem ===
[[Image:Image:Brute force schema.png|naive string search algorithm]]
Given a (short) string p (dubbed pattern) and a
 
--[[User:ThomasHuber|ThomasHuber]] 13:03, 10 January 2008 (EST)

Revision as of 02:03, 10 January 2008

Brute force (naive) search

The simplest, but also least efficient approach to text searching is to check whether the pattern matches the string at every possible position in the string. This is called the brute-force or naive string search algorithm. The procedure is illustrated below.

naive string search algorithm

--ThomasHuber 13:03, 10 January 2008 (EST)