Purpose: Practice using sorting and searching algorithms, and arrays.
Problem: Working in pairs and starting from your jukebox code, or the sample solution for homework 4 (download here), implement a class called Homework5 with a main method that performs the following tasks:
Load all the play lists made available for homework 4 (download zipped play lists) into a jukebox object (sample code).
Combine all the play lists in the jukebox into a single large play list object where tracks are sorted alphabetically by name.
Implement binary search for track names and use it to retrieve the same three tracks from the sorted play list.
Copy the large, sorted play list into an array.
Using the binary search code for arrays presented in lecture, search for the three tracks in the array.
Hints:
It's good style to carefully separate the different parts of your implementation into well-defined, logical methods, each with a single purpose!
We're providing you with sample code to jumpstart your jukebox population routine (download here). You have to integrate it into your jukebox code yourself but that should be really easy.
It doesn't matter which three tracks you search for, except they should be from your own play list. You can hard-code the track names you're interested in into your implementation. If you didn't turn in a play list then use three tracks from a buddy's play list.
Turn-in and due date: Turn in your code in a single file called Homework5.java using the turn-in web page. The due date is Wednesday May 21 at 9 pm.
Time: Finishing this assignment requires as little as a page of code, if you're really careful. However, the sorting and searching code is somewhat intricate, which can put a dent into your time schedule if you have to debug very much. If you're well prepared and carefully decide what you have to do before you start coding, then you should be able to finish this assignment in an afternoon. Attempt to work systematically and efficiently, to better manage your time!
Want more? Here are some suggestions for more fun with sorting and searching. (not worth any points or credit though).