In class practice Sorting and Binary Search
July 17, 2007
a. Download the code: sortAndBinarySearch.java, compile and run it. Read the code to understand the meaning. This code does following steps:
(1) Randomly generate a 10-element array;
(2) Sort the array in ascending order;
(3) Ask a user input and do binary search
b. Modify the code to sort the array in descending order (from big to small) and perform binary search on the obtained array.
c. Modify the code to sort and search on a String array, use compareTo method in the String class. The string array can be initialized by input tokens.