{"id":1000,"date":"2017-03-15T07:08:43","date_gmt":"2017-03-15T14:08:43","guid":{"rendered":"http:\/\/somethingk.com\/main\/?p=1000"},"modified":"2017-03-15T07:08:43","modified_gmt":"2017-03-15T14:08:43","slug":"sequential-search-in-c","status":"publish","type":"post","link":"https:\/\/somethingk.com\/main\/sequential-search-in-c\/","title":{"rendered":"Sequential Search in C++"},"content":{"rendered":"<p>Okay the sequential search\u00a0is easier than the <a href=\"http:\/\/somethingk.com\/main\/?p=994\">recursive<\/a> and <a href=\"http:\/\/somethingk.com\/main\/?p=997\">iterative<\/a> binary searches, I figure I would include it to wrap up searches for now. For the sequential search, you loop through an array (or whatever data structure you are using) checking each\u00a0position for the search value. Works just as well on sorted array lists as it does on unsorted array lists!<\/p>\n<p>Good luck, let me know if you have questions or improvements!<\/p>\n<div class=\"snippetcpt-wrap\" id=\"snippet-1001\" data-id=\"1001\" data-edit=\"\" data-copy=\"\/main\/wp-json\/wp\/v2\/posts\/1000?snippet=17b1fac833&#038;id=1001\" data-fullscreen=\"https:\/\/somethingk.com\/main\/code-snippets\/sequential-search-in-c\/?full-screen=1\">\n\t\t\t\t<pre class=\"prettyprint linenums lang-c_cpp\" title=\"Sequential Search in C++\">int sizeOfArray; \/\/size of array, way easy to store it than calculate it everytime\r\nint* array; \/\/contains a list of integers that you will search through\r\n\r\nbool sequentialFind(int number){\r\n    for(int i = 0; i &lt; sizeOfArray; i++){\r\n        if (array[i] == number){\r\n            return true;\r\n        }\r\n    }\r\n    return false;\r\n}<\/pre>\n\t\t\t<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Okay the sequential search\u00a0is easier than the recursive and iterative binary searches, I figure I would include it to wrap up searches for now. For the sequential search, you loop through an array (or whatever data structure you are using) checking each\u00a0position for the search value. Works just as well on sorted array lists as it does on unsorted array [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[177],"tags":[489,486,303,488,491,487,490,493],"class_list":["post-1000","post","type-post","status-publish","format-standard","hentry","category-development","tag-array","tag-binary-search","tag-c","tag-find","tag-find-int","tag-search","tag-search-array","tag-sequential"],"_links":{"self":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/1000","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/comments?post=1000"}],"version-history":[{"count":1,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/1000\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/1000\/revisions\/1002"}],"wp:attachment":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/media?parent=1000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/categories?post=1000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/tags?post=1000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}