Search algorithm refers to a step-by-step procedure which is used to locate specific data among a collection of data. All search algorithms use a search key in order to proceed for the search operation. The efficiency of a search algorithm is measured by the number of times a comparison of the search key is done in the worst case. The notation used in search algorithms is O(n), where n is the number of comparisons done.
Note: In case if data search, the difference between a fast application and a slower one often lies in the use of the proper search algorithm.
Different search algorithms are available. Here we are describing most commonly used search algorithms linear and binary search. Linear search algorithm is the most basic search algorithm. Binary search is perhaps the best.
Java search algorithms examples
- Java linear search program
- Java linear search program using recursion
- Java binary search program
- Java binarysearch program using recursion