Computer Applications
A binary search of an ordered set of elements in an array is always faster than a sequential search of the elements. True or False ?
Java Arrays
3 Likes
Answer
False
Reason — In a case where the search item is at the first place in a sorted array, sequential search becomes faster than binary search as the first comparison yields the desired value. In case of binary search, the search value is found after some passes are finished.
For example, let us consider an array arr[] = {2, 5, 8, 12} and the search value = 2. In this case, sequential search will find the search value in the first comparison while binary search will first compare the search value with the mid value i.e. 5 and continue its passes.
Answered By
2 Likes
Related Questions
How are the 2-D arrays stored in the memory?
What are the preconditions for Binary Search to be performed on a single dimensional array ?
A binary search of elements in an array requires that the elements be sorted from smallest to largest. True or False ?
The performance of linear search remains unaffected if an unordered array is sorted in ascending order. True or False ?