This is my "Algorithm and Pseudocodes" portfolio project for Codecademy. The task was to create an algorithm, flow chart, and pseudocode for a word pattern recognition program.
Algorithm:
- Input text, the message we want to search through.
- Input pattern, the word we want to search for.
- Has all of text been searched through? If no, continue to step 4. If yes, skip to step 8.
- Iterate to next character of text.
- Create a variable match_count and set it to equal 0.
- Has all of pattern been searched? If no, continue to step 7. If yes, go back to step 3.
- Is this character from pattern equal to the character from text? If yes, increment match_count variable by 1. If no, go back to step 6.
- Does the variable match_count equal the length of pattern? If yes, then pattern has been found! If no, then no pattern has been found.
Flow Chart:
Pseudocode
define text
define pattern
if the entire text hasn't been searched:
iterate to next character of the text
create variable match_count == 0
if the entire pattern hasn't been searched:
if this character from pattern is equal to
the character from text:
increment match_count =+ 1
if match_count equals pattern length:
pattern found!
Following this algorithm and pseudocode, it is possible to create a code to recognize a certain pattern string within a text string.

Top comments (0)