Skip to content

mrinalirao/pattern-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

pattern-search

pattern-search finds all the occurrences of a particular set of characters in a string. It matches the subtext against the textToSearch, outputting the positions of the beginning of each match for the subtext within the textToSearch.

To improve the algorithm further, we could use the KMP Pattern Searching algorithm whose time complexity if O(n)

Getting Started

Running locally

Requirements

To run locally

$ go run main.go

###Input Enter the text to search, press the return/enter key once you have completed the sentence, you will be prompted to enter the subtext

text to search: Peter told me that peter the pickle piper piped a pitted pickle before he petered out. Phew!
subtext:Peter

###Output

[1 20 75]

Test

To run the tests:

$ go test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages