Question: i have this example: 14. Show all the steps for searching the number 60 in the given array using binary search. [6 marks) 0 5

 i have this example: 14. Show all the steps for searching
i have this example:
the number 60 in the given array using binary search. [6 marks)
0 5 5 13 19 22 41 55 68 72 81 98
Example 4 (1) Search worst case t = 42 0 2 3
4 5 6 7 2 5 7 11 15 22 28 35
41 64 min=0 mid=4 max = 9 First Iteration mid = (

14. Show all the steps for searching the number 60 in the given array using binary search. [6 marks) 0 5 5 13 19 22 41 55 68 72 81 98 Example 4 (1) Search worst case t = 42 0 2 3 4 5 6 7 2 5 7 11 15 22 28 35 41 64 min=0 mid=4 max = 9 First Iteration mid = ( min + max )/2 = (0+9)/2 =4 compare t with A[mid] As 42 > 15, adjust the min min=mid + 1 = 4+ 1 = 5 Example 4 (2) Search worst case t = 42 0 ! 2 3 + 5 6 7 2 5 7 11 15 22 28 35 41 64 min - 5 mid=7 max 9 o O Second Iteration mid = ( min + max )/2 = (5 +9)/2 = 7 compare t with A[mid] As 42 > 35, adjust the min min = mid + 1 = 7+ 1 = 8 O O 0 Example 4 (3) Search worst case t=42 0 1 2 3 5 7 8 2 5 7 11 15 22 28 35 41 64 min 8 max = 9 mid=8 o Third Iteration mid=( min + max )/2 =(8 + 9)/2 = 8 compare t with Amid) As 42 > 41, adjust the min min=mid + 1 = 8+ 1 = 9 Example 4 (4) Search worst case t=42 0 1 2 3 4 5 6 7 # 2 5 7 11 15 22 28 35 41 64 max = 9 min9 O Fourth Iteration mid= (min + max 1x)/2=(9+9)/2 = 9 mid=8 o 0 compare t with A[mid] As 42

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 Databases Questions!