• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
July 07, 2022 |27.5K Views

Linear Search vs Binary Search

  Share  2 Likes
Description
Discussion


Assume that item is in an array in random order and we have to find an item. Then the only way to search for a target item is, to begin with, the first position and compare it to the target. If the item is at the same, we will return the position of the current item. 

Otherwise, we will move to the next position. If we arrive at the last position of an array and still can not find the target, we return -1. This is called the Linear search or Sequential search.


Linear Search vs Binary Search : https://www.geeksforgeeks.org/linear-search-vs-binary-search/