Searching Algorithms: Compiled by JN Masi
Searching Algorithms: Compiled by JN Masi
ALGORITHMS
COMPILED BY JN MASI
Searching
• It is a simple algorithm
• Easy to understand and implement
• Does not need a sorted array
Linear search disadvantages
Found=true
Exit
Highest=middle-1
Else
Low =middle + 1
End if
Loop
Binary Search advantages
• The binary search is much more efficient and quicker than the
linear search. Every time it makes a comparison and fails to
find the desired item, it eliminates half of the remaining portion
of the array that must be searched
• Efficient for large lists
• Suitable for storage structure that supports direct access to data
Binary search disadvantages