Question: Consider an array arr [ ] = { 2 , 5 , 8 , 1 2 , 1 6 , 2 3 , 3 8

Consider an array arr[]={2,5,8,12,16,23,38,56,72,91},
and the
i) target =23.
ii) target =8
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
d)(e) Binary search is faster than linear search
Binary search is well-suited 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!