Good code is its own best documentation. As you are about to add a comment, ask yourself, How can I improve the code so that this comment isn't needed? Improve the code and then document it to make it even clearer. Steve McConnell

linear search

Language Java | Level Intermediate | Category Algorithms | August 5, 2015 8:36 am


Algorithm Problem Description

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

Linear search is a simple search algorithm to find the items from the unsorted array. If the array sorted, the developer can use Binary search which search the 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.