<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: David Wishart</title>
    <description>The latest articles on DEV Community by David Wishart (@dwish).</description>
    <link>https://dev.to/dwish</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1914248%2F38bfdb6a-88d9-4664-b759-41cdd54f2686.png</url>
      <title>DEV Community: David Wishart</title>
      <link>https://dev.to/dwish</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dwish"/>
    <language>en</language>
    <item>
      <title>Codecademy Pseudocode Searching Algorithm</title>
      <dc:creator>David Wishart</dc:creator>
      <pubDate>Sun, 11 Aug 2024 16:09:34 +0000</pubDate>
      <link>https://dev.to/dwish/codecademy-pseudocode-searching-algorithm-1bjo</link>
      <guid>https://dev.to/dwish/codecademy-pseudocode-searching-algorithm-1bjo</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The task in the Codecademy Intro to IT Course is to create pseudocode for a pattern searching algorithm, searching for a specific value in a larger set of data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Steps to outline algorithm
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt; Input the text to be searched through and the pattern to look for.&lt;/li&gt;
&lt;li&gt; Create a text_length variable set to the number of characters in the text (redundant!)&lt;/li&gt;
&lt;li&gt; Create a pattern_length variable set to the number of characters in the pattern&lt;/li&gt;
&lt;li&gt; Create a match_count variable set to 0&lt;/li&gt;
&lt;li&gt; Has the entire text been searched? If not continue to 6, if so skip to 9&lt;/li&gt;
&lt;li&gt; Iterate to the next character in text&lt;/li&gt;
&lt;li&gt; Increment text_length (no!)&lt;/li&gt;
&lt;li&gt; Does the current character + pattern_length = pattern
a.  If yes match_count + 1
b.  Else go back to 5.&lt;/li&gt;
&lt;li&gt; Display match_count&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Flowchart
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fundl7n6hsnscbmelojbp.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fundl7n6hsnscbmelojbp.jpeg" alt="Image description" width="800" height="1025"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pseudocode
&lt;/h2&gt;

&lt;p&gt;Define text&lt;br&gt;
Define pattern&lt;br&gt;
Create a patt_length variable and set it to the length of the pattern input&lt;br&gt;
Create a match_count variable and set it to 0&lt;br&gt;
if the entire text hasn’t been searched:&lt;br&gt;
    iterate to the next character in text&lt;br&gt;
    if current character of text + (pattern_length – 1) = pattern&lt;br&gt;
        +1 to match_count&lt;br&gt;
Display “The text contains “pattern” “match_count” times. &lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I guess this should work?! I realised while doing the flowchart that the text_length variable shouldn't be needed so I omitted that from the pseudocode.  Once I learn some languages I would be able to say whether the iteration bit is clear enough to make it through the text from start to finish.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
