This homework is due before class on March 4.
This homework concerns sorting and binary search; most code is provided but requires modification on your part.
A and A.length < 5,
call insertion sort to sort the array instead of continuing
merge sort's divide-and-conquer strategy.
~lorenz/cs35-2/algorithms/sorts/ contains
various sorting algorithms including merge and insertion sorts for strings.
Test your code on an array containing at least 20 strings.
~lorenz/cs35-2/algorithms/searches/;
study it. (For an example of recursion, recall the merge-sort code that calls
merge sort to sort the partitions.)
The signature of your search might be:
public static int binary(String s, String[] A, int low, int high);
where low/high denotes the range in the
array A to search. Your recursive search might be
implemented as follows. If the sought element is not at the
mid position, compute new low/high
values and call your search recursively. Terminate
the recursion when the range no longer contains elements.
Test your program. The main method provided with
the binary search can serve this purpose.
Hand in: complete code and comments for parts one and two.
Hand in scripts that demonstrate that your sort
and search programs work.
instructions on how to submit