{"id":13618,"date":"2022-02-27T21:05:21","date_gmt":"2022-02-27T21:05:21","guid":{"rendered":"https:\/\/exceptionly.com\/?p=13618"},"modified":"2022-06-29T16:35:36","modified_gmt":"2022-06-29T16:35:36","slug":"technical-interview-questions-binary-search-algorithm","status":"publish","type":"post","link":"https:\/\/exceptionly.com\/ar\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/","title":{"rendered":"Technical Interview Questions: Binary Search Algorithm"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"13618\" class=\"elementor elementor-13618\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-a9525ee elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"a9525ee\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-f7b60f3\" data-id=\"f7b60f3\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-a3d277f elementor-widget elementor-widget-text-editor\" data-id=\"a3d277f\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Search algorithms are the essential part of the interviews. And there is a high possibility to face a search algorithm during an interview, tech stack independently. That\u2019s why I decided to walk you through one of the most efficient searching algorithms.<\/p><p>The first round of the most common Interview questions was Sliding Window Technique. So, in <a href=\"https:\/\/exceptionly.com\/2021\/08\/17\/technical-interview-questions-sliding-window-technique\/\">Technical Interview Questions: Sliding Window Technique<\/a> tutorial, I tried to solve a challenging most-asked question with this technique.\u00a0<\/p><p>The winner of the second round indeed will be the Binary Search Algorithm.\u00a0<\/p><h2>What is Binary Search?\u00a0<\/h2><p>Binary Search is one of the most efficient searching algorithms with O(log n) time complexity for the worst-case scenario. If the central index matches the desired value, the best case time complexity would be O(1).\u00a0<\/p><p>Other common names of Binary Search are Half-Interval Search and Logarithmic Search.<\/p><h2>How Binary Search Works?<\/h2><p>The binary search algorithm is working on the principle of repeatedly dividing the search interval in half and finding a target within this half. It compares the desired value to the middle element of the array. In case the middle element does not match the desired value, it will keep looking in half of the array and eliminate another half. To discard half of the array and apply Binary Search, the array must be sorted beforehand.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5c44fd0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5c44fd0\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-4564497\" data-id=\"4564497\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-274ee85 elementor-widget elementor-widget-image\" data-id=\"274ee85\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"511\" height=\"456\" src=\"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/Binary_Search.png\" class=\"attachment-large size-large wp-image-13638\" alt=\"\" srcset=\"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/Binary_Search.png 511w, https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/Binary_Search-300x268.png 300w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-7cb7a0f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"7cb7a0f\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-12bbf8f\" data-id=\"12bbf8f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-8baff5c elementor-widget elementor-widget-text-editor\" data-id=\"8baff5c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><strong>sortedArray = [1,4,5,7,9,13,22];<\/strong><\/p><p><strong>searchTarget = 9;<\/strong><\/p><p><strong>Iteration Start;<\/strong><\/p><ol><li aria-level=\"1\">Element at index 0 sortedArray[0]=1<\/li><li aria-level=\"1\">Last element at index 6 sortedArray[6]=22<\/li><li aria-level=\"1\">Middle element at index 3 is sortedArray[3]=7<\/li><li aria-level=\"1\">Is the middle element equals to the target ?\u00a0<\/li><li aria-level=\"1\">7==9? No!<\/li><li aria-level=\"1\">The target is greater than the middle element, so we can discard the left side of the array and continue to iterate the right side. The remained part of the array we need to consider = [9,13,22];<\/li><li aria-level=\"1\">The new middle is sortedArray[5]=13<\/li><li aria-level=\"1\">Is the middle element equal to the target?\u00a0<\/li><li aria-level=\"1\">13==9? No!\u00a0\u00a0<\/li><li aria-level=\"1\">The target is lower than the middle element, so we can discard the right side of the array and continue to iterate the left side.\u00a0<\/li><li aria-level=\"1\">The remained part of the array we need to consider = [9];<\/li><li aria-level=\"1\">Is the middle element equal to the target?\u00a0<\/li><li aria-level=\"1\">9==9?<\/li><li aria-level=\"1\">Yes, the only remaining element in the array is equal to the target, finalizing the binary search iteration for this particular dataset.<\/li><li aria-level=\"1\">The target element has been found for the given array!<\/li><\/ol><h2>A Simplified Example of Binary Search<\/h2>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-4fabcba elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"4fabcba\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-c50ba80\" data-id=\"c50ba80\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-07b3c88 elementor-widget elementor-widget-code-highlight\" data-id=\"07b3c88\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-java \">\n\t\t\t\t<code readonly=\"true\" class=\"language-java\">\n\t\t\t\t\t<xmp>int[] sortedArray = {1, 4, 5, 7, 9, 13, 22};\nint searchTarget = 9;\nbinarySearch(sortedArray, searchTarget);<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8053edb elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8053edb\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ba2e538\" data-id=\"ba2e538\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-ce10eed elementor-widget elementor-widget-code-highlight\" data-id=\"ce10eed\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"prismjs-tomorrow copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-java \">\n\t\t\t\t<code readonly=\"true\" class=\"language-java\">\n\t\t\t\t\t<xmp>\npublic void binarySearch(int[] sortedArray, int searchTarget) {\n int leftIndex = 0;\n int rightIndex = sortedArray.length - 1;\n\n while (leftIndex <= rightIndex) {\n   int middleElement = leftIndex + ((rightIndex - leftIndex) \/ 2);\n   if (sortedArray[middleElement] < searchTarget) {\n     leftIndex = middleElement + 1;\n   } else if (sortedArray[middleElement] > searchTarget) {\n     rightIndex = middleElement - 1;\n   } else if (sortedArray[middleElement] == searchTarget) {\n     System.out.println(\"Target element is found at index: \" + middleElement);\n     break;\n   }\n }\n\n if (leftIndex > rightIndex) {\n   System.out.println(\"Target element is not found!\");\n }\n}\n<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5a645ab elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5a645ab\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-75ac7db\" data-id=\"75ac7db\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-2ab9813 elementor-widget elementor-widget-text-editor\" data-id=\"2ab9813\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Interviewing for a new job might cause anxiety and stress, but hey, you can prepare for most of the questions. Eventually, with a good plan, you can impress even the toughest interviewers with your successful performance. Feel free to follow the Exceptionly Tech Blog to keep yourself updated. <a href=\"https:\/\/exceptionly.com\/blog\/\">Exceptionly Blog<\/a> is challenging tools, best practices, and methodologies.<\/p><p>Check out some of my other posts that might help you with your interview preparation!<\/p><p><a href=\"https:\/\/exceptionly.com\/2021\/08\/17\/technical-interview-questions-sliding-window-technique\/\">Technical Interview Questions: Sliding Window Technique<\/a><\/p><p><a href=\"https:\/\/exceptionly.com\/2021\/08\/01\/5-top-common-mistakes-every-beginner-java-programmer-makes\/\">Common Mistakes Every Beginner Java Programmer Makes<\/a> \u00a0<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>Search algorithms are the essential part of the interviews. And there is a high possibility to face a search algorithm during an interview, tech stack independently. That\u2019s why I decided to walk you through one of the most efficient searching algorithms. The first round of the most common Interview questions was Sliding Window Technique. So, [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":13705,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[82],"tags":[180,206,179,208,181,139,210,91,207,209,182,112],"class_list":["post-13618","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tutorials","tag-algorithms","tag-backend","tag-binary-search","tag-c","tag-data-structures","tag-node-js","tag-php","tag-python","tag-ruby","tag-scala","tag-sliding-window","tag-technical-interview-questions"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.5 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Technical Interview Questions: Binary Search Algorithm - Exceptionly<\/title>\n<meta name=\"description\" content=\"Binary search is one of the most efficient searching algorithms having the time complexity of O(log n) for the worst-case scenario. In case the central index matches the desired value the best case time complexity would be O(1).\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/exceptionly.com\/ar\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/\" \/>\n<meta property=\"og:locale\" content=\"ar_AR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Technical Interview Questions: Binary Search Algorithm\" \/>\n<meta property=\"og:description\" content=\"Search algorithms are the essential part of the interviews. And there is a high possibility to face a search algorithm during an interview, tech stack\" \/>\n<meta property=\"og:url\" content=\"https:\/\/exceptionly.com\/ar\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/\" \/>\n<meta property=\"og:site_name\" content=\"Exceptionly\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/exceptionly\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-27T21:05:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-29T16:35:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/technical-interview-questions-binary-search-algorithm.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1930\" \/>\n\t<meta property=\"og:image:height\" content=\"766\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Fatma Elverir\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@exceptionly\" \/>\n<meta name=\"twitter:site\" content=\"@exceptionly\" \/>\n<meta name=\"twitter:label1\" content=\"\u0643\u064f\u062a\u0628 \u0628\u0648\u0627\u0633\u0637\u0629\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fatma Elverir\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u0648\u0642\u062a \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0645\u064f\u0642\u062f\u0651\u0631\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u062f\u0642\u0627\u0626\u0642\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/\"},\"author\":{\"name\":\"Fatma Elverir\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#\\\/schema\\\/person\\\/a2600170dfb4513350affede916c0ccf\"},\"headline\":\"Technical Interview Questions: Binary Search Algorithm\",\"datePublished\":\"2022-02-27T21:05:21+00:00\",\"dateModified\":\"2022-06-29T16:35:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/\"},\"wordCount\":480,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/exceptionly.com\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/technical-interview-questions-binary-search-algorithm.jpg\",\"keywords\":[\"Algorithms\",\"Backend\",\"Binary Search\",\"C#\",\"Data Structures\",\"Node.js\",\"PHP\",\"Python\",\"Ruby\",\"Scala\",\"Sliding Window\",\"Technical Interview Questions\"],\"articleSection\":[\"Tutorials\"],\"inLanguage\":\"ar\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/\",\"url\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/\",\"name\":\"Technical Interview Questions: Binary Search Algorithm - Exceptionly\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/exceptionly.com\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/technical-interview-questions-binary-search-algorithm.jpg\",\"datePublished\":\"2022-02-27T21:05:21+00:00\",\"dateModified\":\"2022-06-29T16:35:36+00:00\",\"description\":\"Binary search is one of the most efficient searching algorithms having the time complexity of O(log n) for the worst-case scenario. In case the central index matches the desired value the best case time complexity would be O(1).\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#breadcrumb\"},\"inLanguage\":\"ar\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ar\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#primaryimage\",\"url\":\"https:\\\/\\\/exceptionly.com\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/technical-interview-questions-binary-search-algorithm.jpg\",\"contentUrl\":\"https:\\\/\\\/exceptionly.com\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/technical-interview-questions-binary-search-algorithm.jpg\",\"width\":1930,\"height\":766,\"caption\":\"Technical Interview Questions - Binary Search Algorithm\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/2022\\\/02\\\/27\\\/technical-interview-questions-binary-search-algorithm\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/exceptionly.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Technical Interview Questions: Binary Search Algorithm\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#website\",\"url\":\"https:\\\/\\\/exceptionly.com\\\/\",\"name\":\"Exceptionly\",\"description\":\"Remote software talent acquisition at scale\",\"publisher\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/exceptionly.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ar\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#organization\",\"name\":\"Exceptionly\",\"url\":\"https:\\\/\\\/exceptionly.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ar\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/exceptionly.com\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/exceptionly-search-logo.png\",\"contentUrl\":\"https:\\\/\\\/exceptionly.com\\\/wp-content\\\/uploads\\\/2021\\\/05\\\/exceptionly-search-logo.png\",\"width\":400,\"height\":400,\"caption\":\"Exceptionly\"},\"image\":{\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/exceptionly\\\/\",\"https:\\\/\\\/x.com\\\/exceptionly\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/exceptionly\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCet5wATTyif6knI0h4vUkNA\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/exceptionly.com\\\/#\\\/schema\\\/person\\\/a2600170dfb4513350affede916c0ccf\",\"name\":\"Fatma Elverir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ar\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93179e5b3e943c5bcda6ea20d6b37723c01dedb150ab7724bb4fb9af22eb3de6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93179e5b3e943c5bcda6ea20d6b37723c01dedb150ab7724bb4fb9af22eb3de6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93179e5b3e943c5bcda6ea20d6b37723c01dedb150ab7724bb4fb9af22eb3de6?s=96&d=mm&r=g\",\"caption\":\"Fatma Elverir\"},\"sameAs\":[\"https:\\\/\\\/exceptionly.com\"],\"url\":\"https:\\\/\\\/exceptionly.com\\\/ar\\\/author\\\/fatmaelverir\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Technical Interview Questions: Binary Search Algorithm - Exceptionly","description":"Binary search is one of the most efficient searching algorithms having the time complexity of O(log n) for the worst-case scenario. In case the central index matches the desired value the best case time complexity would be O(1).","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:\/\/exceptionly.com\/ar\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/","og_locale":"ar_AR","og_type":"article","og_title":"Technical Interview Questions: Binary Search Algorithm","og_description":"Search algorithms are the essential part of the interviews. And there is a high possibility to face a search algorithm during an interview, tech stack","og_url":"https:\/\/exceptionly.com\/ar\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/","og_site_name":"Exceptionly","article_publisher":"https:\/\/www.facebook.com\/exceptionly\/","article_published_time":"2022-02-27T21:05:21+00:00","article_modified_time":"2022-06-29T16:35:36+00:00","og_image":[{"width":1930,"height":766,"url":"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/technical-interview-questions-binary-search-algorithm.jpg","type":"image\/jpeg"}],"author":"Fatma Elverir","twitter_card":"summary_large_image","twitter_creator":"@exceptionly","twitter_site":"@exceptionly","twitter_misc":{"\u0643\u064f\u062a\u0628 \u0628\u0648\u0627\u0633\u0637\u0629":"Fatma Elverir","\u0648\u0642\u062a \u0627\u0644\u0642\u0631\u0627\u0621\u0629 \u0627\u0644\u0645\u064f\u0642\u062f\u0651\u0631":"3 \u062f\u0642\u0627\u0626\u0642"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#article","isPartOf":{"@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/"},"author":{"name":"Fatma Elverir","@id":"https:\/\/exceptionly.com\/#\/schema\/person\/a2600170dfb4513350affede916c0ccf"},"headline":"Technical Interview Questions: Binary Search Algorithm","datePublished":"2022-02-27T21:05:21+00:00","dateModified":"2022-06-29T16:35:36+00:00","mainEntityOfPage":{"@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/"},"wordCount":480,"commentCount":1,"publisher":{"@id":"https:\/\/exceptionly.com\/#organization"},"image":{"@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#primaryimage"},"thumbnailUrl":"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/technical-interview-questions-binary-search-algorithm.jpg","keywords":["Algorithms","Backend","Binary Search","C#","Data Structures","Node.js","PHP","Python","Ruby","Scala","Sliding Window","Technical Interview Questions"],"articleSection":["Tutorials"],"inLanguage":"ar","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/","url":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/","name":"Technical Interview Questions: Binary Search Algorithm - Exceptionly","isPartOf":{"@id":"https:\/\/exceptionly.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#primaryimage"},"image":{"@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#primaryimage"},"thumbnailUrl":"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/technical-interview-questions-binary-search-algorithm.jpg","datePublished":"2022-02-27T21:05:21+00:00","dateModified":"2022-06-29T16:35:36+00:00","description":"Binary search is one of the most efficient searching algorithms having the time complexity of O(log n) for the worst-case scenario. In case the central index matches the desired value the best case time complexity would be O(1).","breadcrumb":{"@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#breadcrumb"},"inLanguage":"ar","potentialAction":[{"@type":"ReadAction","target":["https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/"]}]},{"@type":"ImageObject","inLanguage":"ar","@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#primaryimage","url":"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/technical-interview-questions-binary-search-algorithm.jpg","contentUrl":"https:\/\/exceptionly.com\/wp-content\/uploads\/2022\/02\/technical-interview-questions-binary-search-algorithm.jpg","width":1930,"height":766,"caption":"Technical Interview Questions - Binary Search Algorithm"},{"@type":"BreadcrumbList","@id":"https:\/\/exceptionly.com\/2022\/02\/27\/technical-interview-questions-binary-search-algorithm\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/exceptionly.com\/"},{"@type":"ListItem","position":2,"name":"Technical Interview Questions: Binary Search Algorithm"}]},{"@type":"WebSite","@id":"https:\/\/exceptionly.com\/#website","url":"https:\/\/exceptionly.com\/","name":"Exceptionly","description":"Remote software talent acquisition at scale","publisher":{"@id":"https:\/\/exceptionly.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/exceptionly.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ar"},{"@type":"Organization","@id":"https:\/\/exceptionly.com\/#organization","name":"Exceptionly","url":"https:\/\/exceptionly.com\/","logo":{"@type":"ImageObject","inLanguage":"ar","@id":"https:\/\/exceptionly.com\/#\/schema\/logo\/image\/","url":"https:\/\/exceptionly.com\/wp-content\/uploads\/2021\/05\/exceptionly-search-logo.png","contentUrl":"https:\/\/exceptionly.com\/wp-content\/uploads\/2021\/05\/exceptionly-search-logo.png","width":400,"height":400,"caption":"Exceptionly"},"image":{"@id":"https:\/\/exceptionly.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/exceptionly\/","https:\/\/x.com\/exceptionly","https:\/\/www.linkedin.com\/company\/exceptionly\/","https:\/\/www.youtube.com\/channel\/UCet5wATTyif6knI0h4vUkNA"]},{"@type":"Person","@id":"https:\/\/exceptionly.com\/#\/schema\/person\/a2600170dfb4513350affede916c0ccf","name":"Fatma Elverir","image":{"@type":"ImageObject","inLanguage":"ar","@id":"https:\/\/secure.gravatar.com\/avatar\/93179e5b3e943c5bcda6ea20d6b37723c01dedb150ab7724bb4fb9af22eb3de6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/93179e5b3e943c5bcda6ea20d6b37723c01dedb150ab7724bb4fb9af22eb3de6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/93179e5b3e943c5bcda6ea20d6b37723c01dedb150ab7724bb4fb9af22eb3de6?s=96&d=mm&r=g","caption":"Fatma Elverir"},"sameAs":["https:\/\/exceptionly.com"],"url":"https:\/\/exceptionly.com\/ar\/author\/fatmaelverir\/"}]}},"_links":{"self":[{"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/posts\/13618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/comments?post=13618"}],"version-history":[{"count":0,"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/posts\/13618\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/media\/13705"}],"wp:attachment":[{"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/media?parent=13618"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/categories?post=13618"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/exceptionly.com\/ar\/wp-json\/wp\/v2\/tags?post=13618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}