Question: Assume we execute the following algorithm and pass a list of items: (1.4,5.8.9, 12, 18, 20 and 3 as number How many times the comparison
Assume we execute the following algorithm and pass a list of items: (1.4,5.8.9, 12, 18, 20 and 3 as number How many times the comparison at line 7 of the algorithms will be executed write the number of comparisons and all the values of Mid and Tid that we de compared before the algorithm sto Get a value for m. number and T1. Tz. T3... Set the value of found to No Set the value of Start to 1 Set the value of End ton While (Start End) and (found No) Set the value of Mid to (StartEndy2 If number - Tid) //middle value between Start and End Print Mid Set the value of found to Yos Else if (numberTMid Set the value of Start to Mid Else if numberTMidy Sot the value of End to Mid-1 End of While Loop found Noi Print Sony Stop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
