Your cart is currently empty!
You will add three sorting methods to assignment 4, the MovieCollection class. The methods will be: public void sortByName() – Sort the movies in your collection from a – z. Use selection sort. public void sortByTomatoScore() – Sort the movies by tomato score from best to worst. Use insertion sort. public void sortByLength()…
You will add three sorting methods to assignment 4, the MovieCollection class. The methods will be:
You will also be implementing a few methods in the binarySearch.java file provided. The main method and display method are provided. The main method creates two arrays, one which will hold a random collection of ints, which you will randomize, and another which will hold a collection of ints sorted in increasing order.
The main method performs 3 searches.
We do not perform binary search on an unsorted array because binary search requires the array to be sorted. It is a trade off for having faster search times.
Below is a list of methods you will have to implement.
When complete, run the program and search for many different results. If you want to see an immediate difference, search for -1 (there are no negative numbers in the array, so which of the three searches will return first?)
Analyzing Runtimes
Using the MovieCollection class I provided plus the methods you implemented above in MovieCollection, give the Big O notation for each method listed below. Provide your answers directly in the D2L dropbox for the questions below when submitting.
Undergraduate Students – Answer questions 1 – 8. Graduate Students – Answer all questions.