I was asked to design a pattern searching algorithm that included:
- Plan the algorithm
graph TD;
A [Take two string values called text and pattern] → B{Is the length of the pattern greater than the length of the text?};
B – No → C[Search through the value of text to check if the value pattern can be found within text];
C – Pattern found → D[Notify the user that the pattern was found in the text];
C – Pattern not found → E[Notify the user that the pattern was not found in the text];
B – Yes → F[Notify the user that the pattern cannot be found in the text];
-
Draw a flowchart
-
Test the flowchart
This is where I got confused and wasn’t sure how to test the flowchart without actually producing the pseudocode. -
Produce the Pseudocode
def find_pattern(text, pattern):
… for i in range(len(text) - len(pattern) + 1):
… match_count = 0
… for j in range(len(pattern)):
… if text[i+j] == pattern[j]:
… match_count += 1
… if match_count == len(pattern):
… return True
… return False
- Write a Blog post
I feel like this project didn’t explain how to use certain tools that I could have used to finish the project more efficiently. I don’t know how to use python that well and there were no steps to follow in the project to refer back to so I had to dive off on my own and figure it out. I wish they had a better guild line on how to use these tools to get a better result, In my opinion, it would have been a greater success. I did end up finding some great tools while putting this project together called (Mermaid | Diagramming and charting tool) and obsidian.