{"id":5877,"date":"2017-01-03T14:12:37","date_gmt":"2017-01-03T14:12:37","guid":{"rendered":"https:\/\/www.testingdocs.com\/questions\/?p=5877"},"modified":"2024-09-04T07:35:50","modified_gmt":"2024-09-04T07:35:50","slug":"how-to-find-the-minimum-value-in-an-array-flowchart","status":"publish","type":"post","link":"https:\/\/www.testingdocs.com\/questions\/how-to-find-the-minimum-value-in-an-array-flowchart\/","title":{"rendered":"How to find the minimum value in an array flowchart"},"content":{"rendered":"<h2>How to find the minimum value in an array flowchart<\/h2>\n<p>In this post, we will create a flowchart to find the minimum value in an array. We will use the RAPTOR flowchart. We will keep track of the lowest value in an array using a tracking variable <strong>LowestValue<\/strong>. We will assign the first value of the array to this variable.<\/p>\n<p>The first value in the array is :<\/p>\n<p>array_variable[1]<\/p>\n<p>For example marks[1]<\/p>\n<p>To read values into an array, follow the link:<\/p>\n<p><strong><a href=\"https:\/\/www.testingdocs.com\/questions\/how-to-read-values-into-an-array-using-raptor-flowchart\/\">https:\/\/www.testingdocs.com\/questions\/how-to-read-values-into-an-array-using-raptor-flowchart\/<\/a><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5884\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Minimum-value-of-the-array.png\" alt=\"Minimum value of the array\" width=\"1310\" height=\"833\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Minimum-value-of-the-array.png 1310w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Minimum-value-of-the-array-300x191.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Minimum-value-of-the-array-1024x651.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Minimum-value-of-the-array-768x488.png 768w\" sizes=\"auto, (max-width: 1310px) 100vw, 1310px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>After the loop iteration, we will have the minimum array element in the tracking variable. We can use the output symbol to print the lowest element.<\/p>\n<h3>Flowchart<\/h3>\n<p>Let&#8217;s create the flowchart to find the lowest element in the array: marks<\/p>\n<p>FindMin is the RAPTOR procedure that takes the marks array as an input parameter. We can call this procedure using the Call symbol.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5885\" src=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Lowest-value-in-array-flowchart.png\" alt=\"Lowest value in array flowchart\" width=\"1727\" height=\"929\" title=\"\" srcset=\"https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Lowest-value-in-array-flowchart.png 1727w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Lowest-value-in-array-flowchart-300x161.png 300w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Lowest-value-in-array-flowchart-1024x551.png 1024w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Lowest-value-in-array-flowchart-768x413.png 768w, https:\/\/www.testingdocs.com\/questions\/wp-content\/uploads\/Lowest-value-in-array-flowchart-1536x826.png 1536w\" sizes=\"auto, (max-width: 1727px) 100vw, 1727px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>In a loop, we will check every element in the array if the element is lesser than this variable. If the array element is lesser than we store this array element in the tracking variable.<\/p>\n<p>LowestValue &lt;- marks[index]<\/p>\n<p>If the array element is greater than the tracking variable then we already have the minimum value so far in the tracking variable.<\/p>\n<h3>Pseudocode<\/h3>\n<pre>   FUNCTION FindMin(marks)\r\n\r\n      DECLARE index\r\n      DECLARE LowestValue\r\n \r\n      LowestValue = marks(1)\r\n      index = 1\r\n      DO UNTIL index &gt; 5\r\n         IF marks(index) &lt; LowestValue THEN\r\n            LowestValue = marks(index)\r\n         ELSE\r\n         END IF\r\n         index = index + 1\r\n      LOOP\r\n      OUTPUT \"The lowest value in the array=\" + LowestValue\r\n   \r\n    END FUNCTION\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Common mistakes:<\/p>\n<p>In the RAPTOR flowchart, the array index starts with 1 and not with zero. We can&#8217;t use marks[0] to denote the first element, unlike in other programming languages like C, Java etc.<\/p>\n<pre>can't use 0 as an array index<\/pre>\n<p>We know that Alice has 5 subjects. So the index starts with 1 and ends with 5. We can&#8217;t access the array with a higher number as the index. index of the array should be within the interval 1 and length_of(marks)<\/p>\n<p>&nbsp;<\/p>\n<p>Raptor Tutorials on this website can be found at:<\/p>\n<p><a href=\"https:\/\/www.testingdocs.com\/raptor-a-flowchart-tool\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>https:\/\/www.testingdocs.com\/raptor-a-flowchart-tool\/<\/strong><\/a><\/p>\n<p>RAPTOR official website: <a href=\"https:\/\/raptor.martincarlisle.com\/\" rel=\"noopener\"><strong>https:\/\/raptor.martincarlisle.com\/<\/strong><\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to find the minimum value in an array flowchart In this post, we will create a flowchart to find the minimum value in an array. We will use the RAPTOR flowchart. We will keep track of the lowest value in an array using a tracking variable LowestValue. We will assign the first value of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[187],"tags":[208],"class_list":["post-5877","post","type-post","status-publish","format-standard","hentry","category-flowchart","tag-mathematics","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"_links":{"self":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/5877","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/comments?post=5877"}],"version-history":[{"count":19,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/5877\/revisions"}],"predecessor-version":[{"id":24106,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/posts\/5877\/revisions\/24106"}],"wp:attachment":[{"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/media?parent=5877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/categories?post=5877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.testingdocs.com\/questions\/wp-json\/wp\/v2\/tags?post=5877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}