Skip to main content
Have students reason about optimization by creating a program that’ll make an 80 minute playlist for a party.
- The exercise is constructed as follows:
- You have a limited amount of room remaining on your MP3 players and you need to create an 80 minute playlist for a party.
- You begin with a file containing song titles and times.
- You need to be able to solve this problem no matter how many songs are in this file.
- If you have a tie for a song, you need to play your favorite song first.
- While there is a most optimal answer, the goal isn’t to have your students find it.
- As such, don’t expect your students to try every single combination.
- This is a great problem for teaching students to read from a file with a large amount of data, or at least significantly more data than they’re accustomed to.
- When you cover arrays, students will want to put the songs into arrays, sort them, etc.