Skip to content

kanow-algorithms/naive-string-matcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

naive-string-matcher

Requirements

Before testing this code, please make sure you have:

Installation

Clone repo:

git clone https://github.com/kanow-algorithms/naive-string-matcher.git

Testing

To run tests run this command in the root of this project:

cargo test

Description

naive_string_matcher takes two parameters:

  • text → is a reference to vector of all characters in which you want to find the word
  • pattern → is a reference to vector of all search word characters

Example

Input:

let text = vec!['H', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'];
let pattern = vec!['w', 'o', 'r', 'l', 'd'];
naive_string_matcher(&text, &pattern);

Output:

[6]

How it works

On this graphic you can see how naive-string-matcher algorithm works:

NaiveStringMatcher

About

Rust implementation of naive string matcher algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages