{"id":454,"date":"2019-06-05T04:17:24","date_gmt":"2019-06-05T04:17:24","guid":{"rendered":"http:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/?page_id=454"},"modified":"2019-06-10T07:40:55","modified_gmt":"2019-06-10T07:40:55","slug":"lab-3","status":"publish","type":"page","link":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/","title":{"rendered":"Lab 3 &#8211; Searching and Sorting"},"content":{"rendered":"<h1>Part 1 &#8211; Sorting<\/h1>\n<hr \/>\n<h2><\/h2>\n<h2>1.1 &#8211; Bubble Sort<\/h2>\n<hr \/>\n<h3><\/h3>\n<h3>1.1.1 &#8211; Pseudocode<\/h3>\n<hr \/>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\">swapped <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">1<\/span>\r\n    <span style=\"color: #007020;font-weight: bold\">while<\/span> swapped\r\n        swapped <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">0<\/span>\r\n        <span style=\"color: #007020;font-weight: bold\">for<\/span> i from <span style=\"color: #40a070\">0<\/span> to size <span style=\"color: #666666\">-<\/span> <span style=\"color: #40a070\">1<\/span>\r\n           <span style=\"color: #007020;font-weight: bold\">if<\/span> arr[i <span style=\"color: #666666\">&gt;<\/span> arr[i <span style=\"color: #666666\">+<\/span> <span style=\"color: #40a070\">1<\/span>]\r\n              swap( a[i], a[i <span style=\"color: #666666\">+<\/span> <span style=\"color: #40a070\">1<\/span>] )\r\n              swapped <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">1<\/span>\r\n<\/pre>\n<\/div>\n<hr \/>\n<h3><\/h3>\n<h3>1.1.2 &#8211; Time Complexity<\/h3>\n<hr \/>\n<p>Bubble sort being the least efficient sorting algorithm covered in this lab has a worst case of O(n^2).<\/p>\n<p>&nbsp;<\/p>\n<h2>1.2 &#8211; Selection Sort<\/h2>\n<hr \/>\n<h3>1.2.1 &#8211; Pseudocode<\/h3>\n<hr \/>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020;font-weight: bold\">for<\/span> (i <span style=\"color: #666666\">=<\/span> size<span style=\"color: #666666\">-<\/span><span style=\"color: #40a070\">1<\/span>; i <span style=\"color: #666666\">&gt;<\/span> <span style=\"color: #40a070\">0<\/span>; <span style=\"color: #666666\">--<\/span>i)\r\n{\r\n     Set integer index to <span style=\"color: #40a070\">0<\/span> as the index of the largest element\r\n\r\n     Set integer largest to arr[index]\r\n\r\n     <span style=\"color: #007020;font-weight: bold\">for<\/span> (j <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">1<\/span>; j <span style=\"color: #666666\">&lt;=<\/span> i; j<span style=\"color: #666666\">++<\/span>)\r\n     {\r\n           <span style=\"color: #007020;font-weight: bold\">if<\/span> (arr[j] <span style=\"color: #666666\">&gt;<\/span> largest)\r\n               Change largest to arr[j] and index to j\r\n     }\r\n\r\n     swap(arr[i], arr[index])\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>1.2.2 &#8211; Time Complexity<\/h3>\n<hr \/>\n<p>Selection sort is also a quadratic algorithm with a worst case of O(n^2).<\/p>\n<hr \/>\n<h2><\/h2>\n<h2>1.3 &#8211; Insertion Sort<\/h2>\n<hr \/>\n<h3><\/h3>\n<h3>1.3.1 &#8211; Pseudocode<\/h3>\n<hr \/>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\">Set <span style=\"color: #902000\">int<\/span> value i to first<span style=\"color: #666666\">+<\/span><span style=\"color: #40a070\">1<\/span>, where first is the first index of your array\r\n\r\n<span style=\"color: #007020;font-weight: bold\">while<\/span> i <span style=\"color: #666666\">&lt;<\/span> size\r\n     Set integer tmp to arr[i]\r\n     Set <span style=\"color: #902000\">int<\/span> value j to i<span style=\"color: #666666\">-<\/span><span style=\"color: #40a070\">1<\/span>\r\n\r\n     <span style=\"color: #007020;font-weight: bold\">while<\/span> j <span style=\"color: #666666\">&gt;=<\/span> <span style=\"color: #40a070\">0<\/span> and arr[j] <span style=\"color: #666666\">&gt;<\/span> tmp\r\n           Set arr[j<span style=\"color: #666666\">+<\/span><span style=\"color: #40a070\">1<\/span>] equal to arr[j]\r\n           Decrement j\r\n     end <span style=\"color: #007020;font-weight: bold\">while<\/span> \r\n\r\n     Set arr[j<span style=\"color: #666666\">+<\/span><span style=\"color: #40a070\">1<\/span>] equal to tmp\r\n     Increment i\r\nend <span style=\"color: #007020;font-weight: bold\">while<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h1>Part 2 &#8211; Searching<\/h1>\n<hr \/>\n<h2>2.1 &#8211; Serial Search<\/h2>\n<hr \/>\n<h3>2.1.1 &#8211; Pseudocode<\/h3>\n<hr \/>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #60a0b0;font-style: italic\">\/\/ Searches for a desired element in an array of n elements starting from a[first] <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\/\/ where first is the\u00a0first index of the array<\/span>\r\n\r\nSet <span style=\"color: #902000\">int<\/span> value i to <span style=\"color: #40a070\">0<\/span> to use as the index \r\nSet <span style=\"color: #902000\">int<\/span> value found to <span style=\"color: #40a070\">0<\/span> <span style=\"color: #007020;font-weight: bold\">for<\/span> not <span style=\"color: #06287e\">found<\/span> (to be used as boolean <span style=\"color: #40a070\">0<\/span> <span style=\"color: #666666\">-<\/span> not found, <span style=\"color: #40a070\">1<\/span> <span style=\"color: #666666\">-<\/span> found)\r\n\r\n<span style=\"color: #007020;font-weight: bold\">while<\/span> (i <span style=\"color: #666666\">&lt;<\/span> n <span style=\"color: #666666\">&amp;&amp;<\/span>  not found)\r\n{\r\n      <span style=\"color: #007020;font-weight: bold\">if<\/span> (a[first<span style=\"color: #666666\">+<\/span>i] is the desired item)\r\n          set found to <span style=\"color: #40a070\">1<\/span>\r\n      <span style=\"color: #007020;font-weight: bold\">else<\/span>\r\n          increment i\r\n}\r\n\r\n<span style=\"color: #007020;font-weight: bold\">if<\/span> (found)\r\n     The desired element was found at a[first<span style=\"color: #666666\">+<\/span>i].\r\n<span style=\"color: #007020;font-weight: bold\">else<\/span>\r\n     The desired element was not found in the array.\r\n<\/pre>\n<\/div>\n<hr \/>\n<p>&nbsp;<\/p>\n<h3>2.1.2 &#8211; Time Complexity<\/h3>\n<hr \/>\n<p>The average case time complexity for a linear search is (n+1)\/2 array accesses given a linear run time of O(n). A proof for this can be seen as follows:<\/p>\n<p>Given an array of 5 elements there are five possible cases:<\/p>\n<ul>\n<li>Desired element is at arr[0]: there is 1 array access<\/li>\n<li>Desired element is at arr[1]: there are 2 array accesses<\/li>\n<li>Desired element is at arr[2]: there are 3 array accesses<\/li>\n<li>Desired element is at arr[3]: there are 4 array accesses<\/li>\n<li>Desired element is at arr[4]: there are 5 array accesses<\/li>\n<\/ul>\n<p>This gives us an average case of\u00a0 <img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" src=\"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png\" width=\"131\" height=\"37\" \/> = 15 and can be generalized as follows<\/p>\n<h3 style=\"color: #212529\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium\" style=\"font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;font-size: 1rem\" src=\"https:\/\/quicklatex.com\/cache3\/2a\/ql_abf857d367779ca1e346fdcc588cc82a_l3.png\" width=\"335\" height=\"39\" \/><\/h3>\n<hr \/>\n<h2><\/h2>\n<h2>2.2 &#8211; Binary Search<\/h2>\n<hr \/>\n<h3>2.2.1 &#8211; Pseudocode<\/h3>\n<hr \/>\n<p><strong>Parameters:<\/strong><\/p>\n<ul>\n<li>arr &#8211; The array to be searched<\/li>\n<li>first &#8211; The first index of the part of the array to search<\/li>\n<li>size &#8211; The number of elements to search, starting at a[first]<\/li>\n<li>target &#8211; The element desired<\/li>\n<li>location &#8211; Reference to location where item was found<\/li>\n<li>found &#8211; Reference to boolean stating whether the item has been found<\/li>\n<\/ul>\n<p><strong>Precondition:\u00a0<\/strong><\/p>\n<p>If size &gt; 0, then first through first + size &#8211; 1 must be valid indexes for the array arr. Also, starting at arr[first], the next size elements are sorted in increasing order from small to large.<\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020;font-weight: bold\">if<\/span> (size <span style=\"color: #666666\">&lt;=<\/span> <span style=\"color: #40a070\">0<\/span>)\r\n     Set found to <span style=\"color: #007020\">false<\/span>\r\n<span style=\"color: #007020;font-weight: bold\">else<\/span>\r\n{\r\n     middle <span style=\"color: #666666\">=<\/span> index of the approximate midpoint of the array segment;\r\n\r\n     <span style=\"color: #007020;font-weight: bold\">if<\/span> (target <span style=\"color: #666666\">==<\/span> arr[middle])\r\n           Set that the target was found and location to middle\r\n     <span style=\"color: #007020;font-weight: bold\">else<\/span> <span style=\"color: #007020;font-weight: bold\">if<\/span> (target <span style=\"color: #666666\">&lt;<\/span> arr[middle])\r\n           search <span style=\"color: #007020;font-weight: bold\">for<\/span> the target in the area before the midpoint\r\n     <span style=\"color: #007020;font-weight: bold\">else<\/span> <span style=\"color: #007020;font-weight: bold\">if<\/span> (target <span style=\"color: #666666\">&gt;<\/span> arr[middle])\r\n           search <span style=\"color: #007020;font-weight: bold\">for<\/span> the target in the area after the midpoint\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<hr \/>\n<h3>2.2.2 &#8211; Time Complexity<\/h3>\n<hr \/>\n<p>The time complexity of binary search is bounded by O(log n).<\/p>\n<h1>Files Needed<\/h1>\n<hr \/>\n<div><strong>sort.h<\/strong><\/div>\n<div><\/div>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020\">#ifndef SORTER<\/span>\r\n<span style=\"color: #007020\">#define SORTER<\/span>\r\n\r\n<span style=\"color: #007020;font-weight: bold\">class<\/span> <span style=\"color: #0e84b5;font-weight: bold\">sort<\/span>{\r\n\r\n        <span style=\"color: #002070;font-weight: bold\">public:<\/span>\r\n                <span style=\"color: #60a0b0;font-style: italic\">\/\/ Default constructor<\/span>\r\n                sort();\r\n\r\n                <span style=\"color: #902000\">void<\/span>\u00a0<span style=\"color: #06287e\">bubble<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size);\r\n\r\n                <span style=\"color: #902000\">void<\/span>\u00a0<span style=\"color: #06287e\">insertion<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size);\r\n\r\n                <span style=\"color: #902000\">void<\/span>\u00a0<span style=\"color: #06287e\">selection<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size);\r\n\r\n                <span style=\"color: #902000\">void<\/span> <span style=\"color: #06287e\">mergesort<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size);\r\n\r\n                <span style=\"color: #902000\">void<\/span> <span style=\"color: #06287e\">merge<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size1, <span style=\"color: #902000\">size_t<\/span> size2);\r\n\r\n                <span style=\"color: #902000\">void<\/span> <span style=\"color: #06287e\">quicksort<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size);\r\n\r\n                <span style=\"color: #902000\">void<\/span> <span style=\"color: #06287e\">partition<\/span>(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size, <span style=\"color: #902000\">size_t<\/span> <span style=\"color: #666666\">&amp;<\/span> pivot);\r\n};\r\n\r\n<span style=\"color: #007020\">#endif<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong>sort.cpp<\/strong><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020\">#include &lt;iostream&gt;<\/span>\r\n<span style=\"color: #007020\">#include \"sort.h\"<\/span>\r\n\r\nsort <span style=\"color: #666666\">::<\/span> sort()\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ Do nothing<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array containing at least size components<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The elements in the array arr has been sorted so that <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tarr[0] &lt;= arr[1] &lt;= ... &lt;= arr[size-1]\t<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> bubble(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array containing at least size components<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The elements in the array arr has been sorted so that <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tarr[0] &lt;= arr[1] &lt;= ... &lt;= arr[size-1]<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> insertion(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array containing at least size components<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The elements in the array arr have been sorted so that <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tarr[0] &lt;= arr[1] &lt;= ... &lt;= arr[size-1]<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> selection(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array containing at least size components<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The elements of the integer array arr have been sorted so that <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tarr[0] &lt;= arr[1] &lt;= ... &lt;= arr[size-1]<\/span>\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\tNOTE: If there is insufficient dynamic memory, then bad_alloc is thrown. <\/span>\r\n\t\r\n<span style=\"color: #60a0b0;font-style: italic\">\tLibrary facilities used: cstdlib<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> mergesort(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array (or subarray) with at least size1 + size2 <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                      elements. The first size1 elements (from arr[0] to arr[size1 - 1]) <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                      are sorted from smallest to largest, and the last size2 elements <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                      (from arr[size1] to arr[size1 + size2 - 1]) also are sorted from <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                      smallest to largest<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcodition: The first size1 + size2 elements of the integer array arr have <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                      been rearranged to be sorted from smallest to largest.<\/span>\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\tNOTE: If there is insufficient dynamic memory, then bad_alloc is thrown.<\/span>\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\tLibrary facilities used: cstdlib <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span> \r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> merge(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size1, <span style=\"color: #902000\">size_t<\/span> size2)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array containing at least size components.<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The elements of arr have been rearranged so that <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tarr[0] &lt;= arr[1] &lt;= ... &lt;= arr[size-1]<\/span>\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\tLibrary facilities used: cstdlib<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> quicksort(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: The number of elements size &gt; 1 and arr is an integer array <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                     (or subarray) containing at least size elements.<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The function has selected some \"pivot value\" that occurs <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                        in arr[0]...arr[size-1]. The elements of arr have <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t               then been rearranged and the pivot index set so that <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">                       --- arr[pivot_index] is equal to the pivot<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\t       --- each element before arr[pivot_index] is &lt;= the pivot<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\t       --- each element after arr[pivot_index] is &gt; the pivot<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> sort <span style=\"color: #666666\">::<\/span> partition(<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size, <span style=\"color: #902000\">size_t<\/span> <span style=\"color: #666666\">&amp;<\/span> pivot)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong>main.cpp (for sorting)<\/strong><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020\">#include &lt;iostream&gt;<\/span>\r\n<span style=\"color: #007020\">#include \"sort.h\"<\/span>\r\n\r\n<span style=\"color: #902000\">int<\/span> <span style=\"color: #06287e\">main<\/span>(<span style=\"color: #902000\">int<\/span> argc, <span style=\"color: #902000\">char<\/span> <span style=\"color: #666666\">**<\/span> argv)\r\n{\r\n\tsort s;\r\n\r\n\tstd<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"<\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">Starting bubble sort <\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">\"<\/span>;\r\n\r\n\t<span style=\"color: #902000\">int<\/span> arr[<span style=\"color: #40a070\">6<\/span>] <span style=\"color: #666666\">=<\/span> {<span style=\"color: #40a070\">5<\/span>,<span style=\"color: #40a070\">3<\/span>,<span style=\"color: #40a070\">1<\/span>,<span style=\"color: #40a070\">6<\/span>,<span style=\"color: #40a070\">2<\/span>,<span style=\"color: #40a070\">7<\/span>};\r\n\r\n\ts.bubble(arr, <span style=\"color: #40a070\">6<\/span>);\r\n\r\n\t<span style=\"color: #007020;font-weight: bold\">for<\/span> (<span style=\"color: #902000\">int<\/span> i <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">0<\/span>; i <span style=\"color: #666666\">&lt;<\/span> <span style=\"color: #40a070\">6<\/span>; i<span style=\"color: #666666\">++<\/span>)\r\n\t{\r\n\t\tstd<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> arr[i] <span style=\"color: #666666\">&lt;&lt;<\/span> std<span style=\"color: #666666\">::<\/span>endl;\r\n\t}\r\n\t\r\n\tstd<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"<\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">Starting insertion sort <\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">\"<\/span>;\r\n\t\r\n\t<span style=\"color: #902000\">int<\/span> arr2[<span style=\"color: #40a070\">8<\/span>] <span style=\"color: #666666\">=<\/span> {<span style=\"color: #40a070\">13<\/span>, <span style=\"color: #40a070\">6<\/span>, <span style=\"color: #40a070\">7<\/span>, <span style=\"color: #40a070\">21<\/span>, <span style=\"color: #40a070\">45<\/span>, <span style=\"color: #40a070\">9<\/span>, <span style=\"color: #40a070\">2<\/span>, <span style=\"color: #40a070\">100<\/span>};\r\n\r\n\ts.insertion(arr2, <span style=\"color: #40a070\">8<\/span>); \r\n\r\n\t<span style=\"color: #007020;font-weight: bold\">for<\/span> (<span style=\"color: #902000\">int<\/span> i <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">0<\/span>; i <span style=\"color: #666666\">&lt;<\/span> <span style=\"color: #40a070\">8<\/span>; i<span style=\"color: #666666\">++<\/span>)\r\n\t{\r\n\t\tstd<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> arr2[i] <span style=\"color: #666666\">&lt;&lt;<\/span> std<span style=\"color: #666666\">::<\/span>endl;\r\n\t}\r\n\r\n\tstd<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"<\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">Starting selection sort <\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">\"<\/span>;\r\n\r\n\t<span style=\"color: #902000\">int<\/span> arr3[<span style=\"color: #40a070\">16<\/span>] <span style=\"color: #666666\">=<\/span> {<span style=\"color: #40a070\">5<\/span>, <span style=\"color: #40a070\">1<\/span>, <span style=\"color: #40a070\">291<\/span>, <span style=\"color: #40a070\">21<\/span>, <span style=\"color: #40a070\">45<\/span>, <span style=\"color: #40a070\">643<\/span>, <span style=\"color: #40a070\">12<\/span>, <span style=\"color: #40a070\">11<\/span>, <span style=\"color: #40a070\">41<\/span>, <span style=\"color: #40a070\">23<\/span>, <span style=\"color: #40a070\">35<\/span> ,<span style=\"color: #40a070\">46<\/span>, <span style=\"color: #40a070\">51<\/span>, <span style=\"color: #40a070\">231<\/span>, <span style=\"color: #40a070\">21<\/span>, <span style=\"color: #40a070\">7<\/span>};\r\n\r\n\ts.selection(arr3, <span style=\"color: #40a070\">16<\/span>);\r\n\t\r\n\t<span style=\"color: #007020;font-weight: bold\">for<\/span> (<span style=\"color: #902000\">int<\/span> i <span style=\"color: #666666\">=<\/span> <span style=\"color: #40a070\">0<\/span>; i <span style=\"color: #666666\">&lt;<\/span> <span style=\"color: #40a070\">16<\/span>; i<span style=\"color: #666666\">++<\/span>)\r\n\t{\r\n\t\tstd<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> arr3[i] <span style=\"color: #666666\">&lt;&lt;<\/span> std<span style=\"color: #666666\">::<\/span>endl;\r\n\t}\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong>search.h<\/strong><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020\">#ifndef SEARCHER<\/span>\r\n<span style=\"color: #007020\">#define SEARCHER<\/span>\r\n\r\n<span style=\"color: #007020;font-weight: bold\">class<\/span> <span style=\"color: #0e84b5;font-weight: bold\">search<\/span>{\r\n\r\n        <span style=\"color: #002070;font-weight: bold\">public:<\/span> \r\n                <span style=\"color: #60a0b0;font-style: italic\">\/\/ Default constructor<\/span>\r\n                search();\r\n\r\n                <span style=\"color: #902000\">void<\/span> <span style=\"color: #06287e\">serial<\/span> (<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size, int target);\r\n\r\n                <span style=\"color: #902000\">void<\/span> <span style=\"color: #06287e\">binary<\/span> (<span style=\"color: #007020;font-weight: bold\">const<\/span> <span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> first, <span style=\"color: #902000\">size_t<\/span> size, \r\n                        <span style=\"color: #902000\">int<\/span> target, <span style=\"color: #902000\">bool<\/span><span style=\"color: #666666\">&amp;<\/span> found, <span style=\"color: #902000\">size_t<\/span><span style=\"color: #666666\">&amp;<\/span> location);\r\n};\r\n\r\n<span style=\"color: #007020\">#endif<\/span>\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong>search.cpp<\/strong><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020\">#include &lt;iostream&gt;<\/span>\r\n<span style=\"color: #007020\">#include \"search.h\"<\/span>\r\n\r\nsearch <span style=\"color: #666666\">::<\/span> search()\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ Do Nothing<\/span>\r\n}\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tSearches for a desired item in the size array elements starting at arr[first]<\/span>\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: arr is an integer array containing size elements<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: Display to the user whether the desired target was located<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> search <span style=\"color: #666666\">::<\/span> serial (<span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> size, <span style=\"color: #902000\">int<\/span> target)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\/*<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPrecondition: The integer array segment starting at arr[first] and <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\tcontaining size elements is sorted from smallest to largest.<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\tPostcondition: The integer array segment starting at arr[first] and <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\tcontaing size elements has been searched for the target. If<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\tthe target was present, then found is true, and location is <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\tset so that target --- arr[location]. Otherwise, found is <\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">\t\tset to false.<\/span>\r\n\r\n<span style=\"color: #60a0b0;font-style: italic\">\tLibrary facilities used: cstdlib (provides size_t from namespace std)<\/span>\r\n<span style=\"color: #60a0b0;font-style: italic\">*\/<\/span>\r\n<span style=\"color: #902000\">void<\/span> search <span style=\"color: #666666\">::<\/span> binary (<span style=\"color: #007020;font-weight: bold\">const<\/span> <span style=\"color: #902000\">int<\/span> <span style=\"color: #666666\">*<\/span> arr, <span style=\"color: #902000\">size_t<\/span> first, <span style=\"color: #902000\">size_t<\/span> size,\r\n\t\t<span style=\"color: #902000\">int<\/span> target, <span style=\"color: #902000\">bool<\/span><span style=\"color: #666666\">&amp;<\/span> found, <span style=\"color: #902000\">size_t<\/span><span style=\"color: #666666\">&amp;<\/span> location)\r\n{\r\n\t<span style=\"color: #60a0b0;font-style: italic\">\/\/ YOUR CODE HERE<\/span>\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><strong>main.cpp<\/strong><\/p>\n<div style=\"background: #f0f0f0;overflow: auto;width: auto;border: solid gray;border-width: .1em .1em .1em .8em;padding: .2em .6em\">\n<pre style=\"margin: 0;line-height: 125%\"><span style=\"color: #007020\">#include &lt;iostream&gt;<\/span>\r\n<span style=\"color: #007020\">#include \"search.h\"<\/span>\r\n\r\n<span style=\"color: #902000\">int<\/span> <span style=\"color: #06287e\">main<\/span>(<span style=\"color: #902000\">int<\/span> argc, <span style=\"color: #902000\">char<\/span> <span style=\"color: #666666\">**<\/span> argv)\r\n{\r\n        search s;\r\n\r\n        <span style=\"color: #902000\">int<\/span> arr[<span style=\"color: #40a070\">10<\/span>] <span style=\"color: #666666\">=<\/span> {<span style=\"color: #40a070\">1<\/span>, <span style=\"color: #40a070\">3<\/span>, <span style=\"color: #40a070\">5<\/span>, <span style=\"color: #40a070\">7<\/span>, <span style=\"color: #40a070\">11<\/span>, <span style=\"color: #40a070\">13<\/span>, <span style=\"color: #40a070\">17<\/span>, <span style=\"color: #40a070\">19<\/span>, <span style=\"color: #40a070\">21<\/span>, <span style=\"color: #40a070\">23<\/span>};\r\n\r\n        s.serial(arr, <span style=\"color: #40a070\">10<\/span>, <span style=\"color: #40a070\">11<\/span>);\r\n        s.serial(arr, <span style=\"color: #40a070\">10<\/span>, <span style=\"color: #40a070\">100<\/span>);\r\n\r\n        <span style=\"color: #902000\">bool<\/span> found;\r\n        <span style=\"color: #902000\">size_t<\/span> location;\r\n\r\n        s.binary(arr, <span style=\"color: #40a070\">0<\/span>, <span style=\"color: #40a070\">10<\/span>, <span style=\"color: #40a070\">19<\/span>, found, location);\r\n\r\n        <span style=\"color: #007020;font-weight: bold\">if<\/span> (found)\r\n                std<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"Found at location: \"<\/span> <span style=\"color: #666666\">&lt;&lt;<\/span> location <span style=\"color: #666666\">&lt;&lt;<\/span> std<span style=\"color: #666666\">::<\/span>endl;\r\n        <span style=\"color: #007020;font-weight: bold\">else<\/span>\r\n                std<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"Not found<\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">\"<\/span>;\r\n\r\n        s.binary(arr, <span style=\"color: #40a070\">0<\/span>, <span style=\"color: #40a070\">10<\/span>, <span style=\"color: #40a070\">4<\/span>, found, location);\r\n\r\n        <span style=\"color: #007020;font-weight: bold\">if<\/span> (found)\r\n                std<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"Found at location: \"<\/span> <span style=\"color: #666666\">&lt;&lt;<\/span> location <span style=\"color: #666666\">&lt;&lt;<\/span> std<span style=\"color: #666666\">::<\/span>endl;\r\n        <span style=\"color: #007020;font-weight: bold\">else<\/span>\r\n                std<span style=\"color: #666666\">::<\/span>cout <span style=\"color: #666666\">&lt;&lt;<\/span> <span style=\"color: #4070a0\">\"Not found<\/span><span style=\"color: #4070a0;font-weight: bold\">\\n<\/span><span style=\"color: #4070a0\">\"<\/span>;\r\n\r\n        <span style=\"color: #007020;font-weight: bold\">return<\/span> <span style=\"color: #40a070\">0<\/span>;\r\n}\r\n<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<hr \/>\n<p>&nbsp;<\/p>\n<h1>Extra Credit<\/h1>\n<hr \/>\n<h2><\/h2>\n<h2>EC 1<\/h2>\n<hr \/>\n<p>Each term appearing in the Fibonacci sequence is the sum of the previous two terms in the sequence. Starting with the two terms 0 and 1 the first 10 terms in the sequence will be<\/p>\n<p style=\"text-align: center\">0, 1, 1, 2, 3, 5, 8, 13, 21, 34, &#8230;<\/p>\n<p>Using an iterative approach to generating the Fibonacci sequence, create a program that will find the sum of all even terms less than 4 million. <strong>Expected output: 4613732<\/strong><\/p>\n<hr \/>\n<h2><\/h2>\n<h2>EC 2<\/h2>\n<hr \/>\n<p>Implement <strong>Mergesort<\/strong> and <strong>Merge<\/strong> in sort.cpp and demo its functionality in main.cpp<\/p>\n<hr \/>\n<h1><\/h1>\n<h2>EC 3<\/h2>\n<hr \/>\n<p>Implement\u00a0<strong>Partition\u00a0<\/strong>and\u00a0<strong>Quicksort<\/strong> in sort.cpp and demo its functionality in main.cpp<\/p>\n<hr \/>\n<h1><\/h1>\n<h1>What to submit?<\/h1>\n<hr \/>\n<p><strong>Lab3_LastName_FirstName.zip<br \/>\n|<br \/>\n|&#8212;&#8211;&gt; Lab 3<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|&#8212;&#8211;&gt;Sorting<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;sort.h<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;sort.cpp<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;main.cpp<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;Makefile<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|&#8212;&#8211;&gt;Searching<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;search.h<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;search.cpp<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;main.cpp<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;Makefile<br \/>\n<\/strong><strong>|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|&#8212;&#8211;&gt;ExtraCredit<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;ec1.cpp<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |<br \/>\n|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0|\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 |&#8212;&#8211;&gt;Makefile<br \/>\n<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Part 1 &#8211; Sorting 1.1 &#8211; Bubble Sort 1.1.1 &#8211; Pseudocode swapped = 1 while swapped swapped = 0 for i from 0 to size &#8211; 1 if arr[i &gt; &hellip; <a href=\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/\" class=\"\">Read More<\/a><\/p>\n","protected":false},"author":129,"featured_media":0,"parent":371,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"template-custom.php","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-454","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Lab 3 - Searching and Sorting - Demetrios Lambropoulos<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Lab 3 - Searching and Sorting - Demetrios Lambropoulos\" \/>\n<meta property=\"og:description\" content=\"Part 1 &#8211; Sorting 1.1 &#8211; Bubble Sort 1.1.1 &#8211; Pseudocode swapped = 1 while swapped swapped = 0 for i from 0 to size - 1 if arr[i &gt; &hellip; Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/\" \/>\n<meta property=\"og:site_name\" content=\"Demetrios Lambropoulos\" \/>\n<meta property=\"article:modified_time\" content=\"2019-06-10T07:40:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/\",\"url\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/\",\"name\":\"Lab 3 - Searching and Sorting - Demetrios Lambropoulos\",\"isPartOf\":{\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png\",\"datePublished\":\"2019-06-05T04:17:24+00:00\",\"dateModified\":\"2019-06-10T07:40:55+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#primaryimage\",\"url\":\"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png\",\"contentUrl\":\"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Program Methodology I Lab Summer 2019\",\"item\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Lab 3 &#8211; Searching and Sorting\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/#website\",\"url\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/\",\"name\":\"Demetrios Lambropoulos\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Lab 3 - Searching and Sorting - Demetrios Lambropoulos","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/","og_locale":"en_US","og_type":"article","og_title":"Lab 3 - Searching and Sorting - Demetrios Lambropoulos","og_description":"Part 1 &#8211; Sorting 1.1 &#8211; Bubble Sort 1.1.1 &#8211; Pseudocode swapped = 1 while swapped swapped = 0 for i from 0 to size - 1 if arr[i &gt; &hellip; Read More","og_url":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/","og_site_name":"Demetrios Lambropoulos","article_modified_time":"2019-06-10T07:40:55+00:00","og_image":[{"url":"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/","url":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/","name":"Lab 3 - Searching and Sorting - Demetrios Lambropoulos","isPartOf":{"@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#primaryimage"},"image":{"@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#primaryimage"},"thumbnailUrl":"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png","datePublished":"2019-06-05T04:17:24+00:00","dateModified":"2019-06-10T07:40:55+00:00","breadcrumb":{"@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#primaryimage","url":"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png","contentUrl":"https:\/\/quicklatex.com\/cache3\/c5\/ql_bafd6001e6743b7f9e60fc723c3ab4c5_l3.png"},{"@type":"BreadcrumbList","@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/lab-3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/"},{"@type":"ListItem","position":2,"name":"Program Methodology I Lab Summer 2019","item":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/program-methodology-i-lab-summer-2019\/"},{"@type":"ListItem","position":3,"name":"Lab 3 &#8211; Searching and Sorting"}]},{"@type":"WebSite","@id":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/#website","url":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/","name":"Demetrios Lambropoulos","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/pages\/454"}],"collection":[{"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/users\/129"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/comments?post=454"}],"version-history":[{"count":10,"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/pages\/454\/revisions"}],"predecessor-version":[{"id":466,"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/pages\/454\/revisions\/466"}],"up":[{"embeddable":true,"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/pages\/371"}],"wp:attachment":[{"href":"https:\/\/sites.rutgers.edu\/demetrios-lambropoulos\/wp-json\/wp\/v2\/media?parent=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}