Question: if we have a SORTED array of ( mathrm{N} ) numbers: 1. Look at the middle element at the position of ( mathrm{N} / 2

if we have a SORTED array of ( mathrm{N} ) numbers: 1. Look at the middle element at the position of ( mathrm{N} / 2 ) 2. If the search element is less than the element at position ( N / 2 ), then repeat the process using only the left side of the array (1-N/2) 3. If the search element is greater than the element in position ( N / 2 ), then repeat the process using only the right side of the array 4. If the search element is equal to the element in position N/2, the search is completed END 5. Continue to repeat the process until either the element is found or N/2 = 1
 if we have a SORTED array of ( mathrm{N} ) numbers:

Description In summary, if we have a SORTED array of N numbers: 1. Look at the middle element at the position of N/2 2. If the search element is less than the element at position N/2, then repeat the process using only the left side of the array (1-N/2) 3. If the search element is greater than the element in position N/2, then repeat the process using only the right side of the array 4. If the search element is equal to the element in position N/2, the search is completed END 5. Continue to repeat the process until either the element is found or N/2 = 1

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!