Question: Consider an array arr [ ] = { 2 , 5 , 8 , 1 2 , 1 6 , 2 3 , 3 8
Consider an array arr
and the
i target
ii target
a Write step by step how to find the target key.
b Write an algorithm
c Write the code snippet of how to find the mid point in the above array
d What is an advantage of binary search over linear search?
e Disadvantages of binary search
de Binary search is faster than linear search
Binary search is wellsuited for searching large datasets
It can be used for searching in computer graphics such as algorithms for tracing
But, the array should be sorted. Binary search requires that the data structure being searched be
stored in contiguous memory locations. Binary search requires that the elements of the array be
comparable, meaning that they must be able to be ordered.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
