DEV Community

Myles Turner
Myles Turner

Posted on

Codecademy Algorithms and Pseudocodes Portfolio Project

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:

  1. Input text, the message we want to search through.
  2. Input pattern, the word we want to search for.
  3. Has all of text been searched through? If no, continue to step 4. If yes, skip to step 8.
  4. Iterate to next character of text.
  5. Create a variable match_count and set it to equal 0.
  6. Has all of pattern been searched? If no, continue to step 7. If yes, go back to step 3.
  7. 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.
  8. 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:

Image description

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)