Question: Problem 11 Write a method that inserts a string into a sorted array of strings. Assume that the array is not full - take an
Problem 11 Write a method that inserts a string into a sorted array of strings. Assume that the array is not full - take an input that tells you how many actual strings are in the array (the array is being used as a container). Since the strings are sorted, use binary search to locate the insertion point. You will have to shift items to the right by one slot in order to make room for the item being inserted. The item to be inserted will not be in the array, so locating the insertion point requires letting the search fail and recording where in the array you are when it fails. You must think carefully about the precise index at which to insert the new item after this.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
