Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please solve the following questions: Please show your work in solving it and in clear writing. Thank You. 1) Which of the following is true

Please solve the following questions:

image text in transcribed

Please show your work in solving it and in clear writing. Thank You.

1) Which of the following is true about the binary search algorithm? a. If you use it on a sorted array, the performance in the worst case scenario is Odlog n) b. If you use it on an unsorted array, the performance in the worst case scenario is 0(1) c. Binary search performance in the worst case scenario degrades to O(n) if the size of the array gets too large d. None of the above 2) Which of the following is true about inserting elements using binary search into a sorted array? a. The performance in the worst case scenario is O(n) because of the shifting of elements b. The performance in the worst case scenario is O(log n) because of the use of binary search to find the index to insert the new element c. Even though insert using linear search and insert using binary search are both O(n), in the worst case insert with linear search is a guaranteed O(n) while insert with binary search is O(log n) + O(n) d. None of the above 3) Which of the following is true about the deleting elements in a sorted array? a. Worst case scenario for delete is O(log n) b. If you used binary search to find the element to delete and found it at the end of the array, the performance is O(n) because you have to shift all elements C. If you delete using linear search to find the element, the performance in the worst case is O(na) d. None of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions