DEV Community

WLBurkss
WLBurkss

Posted on

Software Development Concepts

Hi all, I am working to get my certification of completion in an Introduction to IT course given through Codecademy in which one of the tasks was to create a blog post on a given project. In this project, I will be designing a pattern searching algorithm. This is a commonly used algorithm that searches for a specific value within a larger set of data. For example, we can use this algorithm to search for a word in a specific body of text, like a dictionary.

Step 1: Plan the Algorithm
-two string values called "text" and "pattern"
-search through the value of text to check if the value pattern can be found within
-notify the user if the pattern was found in text or not

We will need to create both a string variable called "text" and "pattern". Then we need to search through the text variable for any character matches to the pattern variable.
In order to do this, we will need to create a match variable and initialize it to 0. Then as we iterate through the text if the character matches pattern, we can increment the match variable and if the match variable and pattern lengths are equal, we will know we have match.

Step 2: Create a Flowchart

Image description

Step 3: Create Pseudocode

define text
define pattern
create a match variable and set is to 0
if all of text has not been searched then:
iterate to the next character in text
if all of pattern has not been searched then:
if the character from pattern is equal to the
character in text then:
increment the match variable
if match is equal to the length of pattern
return Pattern Found!!
else
return Pattern NOT Found!!

For those that have gotten this far thank you for your time and if there any improvements I could make I would greatly appreciate your input below, thanks!

Top comments (0)