True or False  For each statement below, indicate whether you think it is True or False.    If you use binary search on a sorted array, the performance at worst is O(log n) For the insert algorithm

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter9: Advanced Array Concepts
Section: Chapter Questions
Problem 3RQ
icon
Related questions
Question

True or False 

For each statement below, indicate whether you think it is True or False. 

 

  • If you use binary search on a sorted array, the performance at worst is O(log n)
  • For the insert algorithm, if you use binary search to find the location to insert the new element, it will improve the overall performance of the algorithm to O(log n)
  • For the update algorithm in a sorted array, all you have to do is use linear or binary search to find the element you want to change, and if you find it, you only need to change it to the new value
  • Binary search can be used on an unsorted array
  • Inserting elements into a sorted array is O(n) because you have to find the location to add the new element and then shift the remaining elements
  • If the sorted array gets too large, the performance of binary search becomes O(n)
  • For the delete algorithm, after you find the element to delete, you can make the algorithm run faster by replacing it with the last element in the array
  • If you used binary search to find the element to delete, the performance is still O(n) because you may have to shift all elements
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT