KnowledgeBoat Logo
|
LoginJOIN NOW

Computer Applications

What is the difference between the linear search and the binary search technique?

Java Arrays

ICSE 2019

31 Likes

Answer

Linear searchBinary search
Linear search works on sorted and unsorted arrays.Binary search works on only sorted arrays.
In Linear search, each element of the array is checked against the target value until the element is found or end of the array is reached.In Binary search, array is successively divided into 2 halves and the target element is searched either in the first half or in the second half.
Linear Search is slower.Binary Search is faster.

Answered By

18 Likes


Related Questions