Pattern Matching Program in C Language

Posted by Crniranjanraj under Others on 10/5/2015 | Points: 10 | Views : 1994 | Status : [Member] | Replies : 1
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. Assume that n > m.

Examples:

1) Input:

txt[] = "THIS IS A TEST TEXT"
pat[] = "TEST"

Output:

Pattern found at index 10

2) Input:

txt[] = "AABAACAADAABAAABAA"
pat[] = "AABA"

Output:

Pattern found at index 0
Pattern found at index 9
Pattern found at index 13

I want the full program in C language




Responses

Posted by: Godfather on: 1/28/2016 [Member] Starter | Points: 25

Up
0
Down
You should follow below mentioned link where you can find your solution easily.
http://www.geeksforgeeks.org/tag/pattern-searching/

Crniranjanraj, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response