Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to to, let us concentrate rather on explaining to human beings what we want a computer to do. Donald Knuth

Linear search

Language Java | Level Intermediate | Category Algorithms | August 3, 2015 10:07 am


Algorithm Problem Description

Linear search is a method to find a particular item in an array. It start to check each item and compare with search item until it finds. The linear search performs non-sorted items in the array.

Linear search is a simple search algorithm to find the items from the unsorted array. If you want to search the item in the sorted array, we can use Binary search. It searches an item in less number of comparison.

Write a program to implement linear search.

Output

          	        
          	        

List of items in the array: [12, 55, 45, 11, 23, 20, 17, 24, 9]
Search '12' in the array using linear search
Found in 1 Position!

          	        
          	        				    


Comments



Please login to add comments.