Question: 5) Use the following array to trace the first two iterations of the binary search algorithm for the specified target value. For each iteration, indicate

5) Use the following array to trace the first two iterations of the binary search algorithm for the specified target value. For each iteration, indicate the midpoint index, and the index range [first, last] for the sublist in the next iteration. Hint: the index starts from zero and the midpoint index is equal to [(first+last)/2]
Array with 9 elements: 2, 10, 19, 23, 28, 35, 45, 51, 55
Target 51
Iteration 1: Midpoint index: _________________________
Index range for the next sublist: [ _________________, _______________ ]
Iteration 2: Midpoint index: _________________________
Index range for the next sublist: [ _________________, _______________ ]

5; [6,9]; 7; [8,9]

28; [35,55]; 45; [51,55]

4; [5,8]; 6; [7,8]

6)

Which of the following algorithms are not based on swapping elements?

Bubble sort

Merge sort

Insertion sort

Selection sort

7)

Which of the following algorithms performance is not affected by the state of the input array to be sorted?

Insertion sort

Bubble sort

Selection sort

Merge sort

8) Binary searches worst case Big O time complexity is the same as its average case Big O time complexity

True

False

9) Assume you have a set of arrays sorted in reverse order of increasing size. Which of the following sorting algorithms would you expect to display the best Big O time complexity?

Optimized Bubble sort

Merge sort

Selection sort

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!