{"id":548,"date":"2023-03-23T07:35:42","date_gmt":"2023-03-23T07:35:42","guid":{"rendered":"http:\/\/learnlearn.uk\/ibcs\/?page_id=548"},"modified":"2025-04-05T11:00:11","modified_gmt":"2025-04-05T11:00:11","slug":"sequential-linear-search","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/","title":{"rendered":"Sequential (Linear) Search"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Introduction to Linear Search<\/h2>\n<div class=\"tabcontent\">\n\n<h2>Introduction to Linear Search<\/h2>\n<p class=\"\">Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed.<\/p>\n<p class=\"\">\n<h3 class=\"\">Algorithm Steps<\/h3>\n<p>&nbsp;<\/p>\n<p class=\"\">\n<ol>\n<li>Start at the beginning of the list.<\/li>\n<\/ol>\n<ol>\n<li>Compare the target value with the current element.<\/li>\n<\/ol>\n<ol>\n<li>If the target value matches the current element, the search is successful and the position of the element is returned.<\/li>\n<\/ol>\n<ol>\n<li>If the target value does not match the current element, move to the next element in the list.<\/li>\n<\/ol>\n<ol>\n<li>Repeat steps 2-4 until a match is found or the end of the list is reached.<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">None<\/h2>\n<div class=\"tabcontent\">\n\n<h2>None<\/h2>\n<p><iframe loading=\"lazy\" title=\"Binary Search\" src=\"https:\/\/revise.learnlearn.uk\/teachassist\/static\/static_pages\/linear_search.html\" width=\"800\" height=\"400\" frameborder=\"0\" data-mce-fragment=\"1\"><\/iframe>\n<\/div><h2 class=\"tabtitle\">Time &amp; Space Complexity<\/h2>\n<div class=\"tabcontent\">\n<\/p>\n<h2>Time &amp; Space Complexity<\/h2>\n<h3 class=\"\">Time complexity &#8211; O(n)<\/h3>\n<p>Because linear search potentially needs to check each item (n) in the list once in the list, the time complexity is O(n)<\/p>\n<h3 class=\"\">Space complexity O(1)<\/h3>\n<p>The space complexity of a linear search algorithm is generally O(1), which means it uses a constant amount of additional memory regardless of the size of the input data. This is because a linear search does not require any additional data structures or memory allocation that scales with the size of the input.<\/p>\n<p>You may use a few variables for control and temporary storage, but the memory usage remains constant and doesn&#8217;t depend on the size of the input data.<\/p>\n\n<\/div><h2 class=\"tabtitle\">Pros and Cons of Linear Search<\/h2>\n<div class=\"tabcontent\">\n\n<h2>Pros and Cons of Linear Search<\/h2>\n<h3 class=\"\">Advantages<\/h3>\n<ul>\n<li>Simple and easy to understand<\/li>\n<li>Works on both sorted and\u00a0<b>unsorted lists<\/b><\/li>\n<li>Works well for small data sets<\/li>\n<li>Useful if you expect the item to be near the beginning of the list<\/li>\n<\/ul>\n<h3 class=\"\">Disadvantages<\/h3>\n<ul>\n<li>Inefficient for large data sets<\/li>\n<li>Time complexity: O(n), where n is the size of the list<\/li>\n<li>Can be slow compared to other search algorithms<\/li>\n<\/ul>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to Linear Search Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed. Algorithm Steps &nbsp; Start at the beginning of the list. Compare the target value with the current element.&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Sequential (Linear) Search<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"off","neve_meta_content_width":70,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Sequential (Linear) Search - IB Computer Science<\/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:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sequential (Linear) Search - IB Computer Science\" \/>\n<meta property=\"og:description\" content=\"Introduction to Linear Search Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed. Algorithm Steps &nbsp; Start at the beginning of the list. Compare the target value with the current element.&hellip;&nbsp;Read More &raquo;Sequential (Linear) Search\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/\" \/>\n<meta property=\"og:site_name\" content=\"IB Computer Science\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-05T11:00:11+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/\",\"name\":\"Sequential (Linear) Search - IB Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#website\"},\"datePublished\":\"2023-03-23T07:35:42+00:00\",\"dateModified\":\"2025-04-05T11:00:11+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"IB Computer Science\",\"item\":\"https:\/\/learnlearn.uk\/ibcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sequential (Linear) Search\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#website\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/\",\"name\":\"IB Computer Science\",\"description\":\"- learnlearn..uk\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/ibcs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#organization\",\"name\":\"IB Computer Science\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png\",\"width\":300,\"height\":41,\"caption\":\"IB Computer Science\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sequential (Linear) Search - IB Computer Science","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:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/","og_locale":"en_GB","og_type":"article","og_title":"Sequential (Linear) Search - IB Computer Science","og_description":"Introduction to Linear Search Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed. Algorithm Steps &nbsp; Start at the beginning of the list. Compare the target value with the current element.&hellip;&nbsp;Read More &raquo;Sequential (Linear) Search","og_url":"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/","og_site_name":"IB Computer Science","article_modified_time":"2025-04-05T11:00:11+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/","url":"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/","name":"Sequential (Linear) Search - IB Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/ibcs\/#website"},"datePublished":"2023-03-23T07:35:42+00:00","dateModified":"2025-04-05T11:00:11+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/ibcs\/sequential-linear-search\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"IB Computer Science","item":"https:\/\/learnlearn.uk\/ibcs\/"},{"@type":"ListItem","position":2,"name":"Sequential (Linear) Search"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/ibcs\/#website","url":"https:\/\/learnlearn.uk\/ibcs\/","name":"IB Computer Science","description":"- learnlearn..uk","publisher":{"@id":"https:\/\/learnlearn.uk\/ibcs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/ibcs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/ibcs\/#organization","name":"IB Computer Science","url":"https:\/\/learnlearn.uk\/ibcs\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png","contentUrl":"https:\/\/learnlearn.uk\/ibcs\/wp-content\/uploads\/sites\/25\/2022\/09\/LearnLearnLogowhite-300x41.png","width":300,"height":41,"caption":"IB Computer Science"},"image":{"@id":"https:\/\/learnlearn.uk\/ibcs\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/ibcs\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Introduction to Linear Search Linear search, also known as sequential search, is a simple searching algorithm that checks each element of a list in order until a match is found or the entire list has been traversed. Algorithm Steps &nbsp; Start at the beginning of the list. Compare the target value with the current element.&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages\/548"}],"collection":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/comments?post=548"}],"version-history":[{"count":2,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages\/548\/revisions"}],"predecessor-version":[{"id":1195,"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/pages\/548\/revisions\/1195"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/ibcs\/wp-json\/wp\/v2\/media?parent=548"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}