Florida Southern Sunset
CSC 3380: Algorithms
(Spring 2025)

Syllabus

LMS

Teachers

Assignments
Assignments


Other Pages

Project 4:
Sibling Songs


Assigned: Fri Apr 04 2025
Due: 11:59:00 PM on Fri Apr 25 2025
Team Size: 2
Language: Java
Out of: 100 points


Your younger sibling just found out about rock music because they signed up for a website and have been making a list of their favorite songs. They have started asking you to make cool mixes of their playlist of favorite songs. You super want them to leave you alone, so you finally relent. After fidling around with the website for a few minutes, you realize the playlist creator is dumb and you can't reorder songs. You also know that if you pick any two songs that are adjacent in the list, your sibling will complain that it's too similar to their list. You realize that the best thing to do is to create the longest playlist you can to occupy your sibling without picking neighboring songs.

Part 0, 0 points: Look at the instructions below to organize your code to simplify the submission process.

Part 1, 0 points: Create a new file, SongSelector.java, in which you will add a static method, chooseSongs, that takes an List of integers (the lengths of the songs) and returns an List of integers that contains the indices of the songs you pick to include in the playlist. You are welcome to include any other methods/classes you want, so long as they are all called by this method.

Part 2, 0 points: Add a JavaDoc comment header to describe your project and list who is in your team. Additionally, add a method to your class, getAuthors, that returns a string with the names of all members of your team, like this:

    /**
     * Returns the authors' names.
     * @return  The names of the authors of this file.
     */
    public static String getAuthors() {
        return "Anne Borgin and Kyle Burke";
    }

Part 3, 0 points:

You'll need these files in order to run the tester:

Part 4, 100 points: Your grade will be based on the longest song lists that you can correctly find the longest sublist for in a restricted amount of time. Here is my SongSelectorTester.java, which will run your code on increasingly larger lists of song lengths. It does not check the validity of larger trials due to time constraints. (If you submit it to me, I will be able to check the validity.) Important notes:

  • If any of the tests produce the wrong answer, you won't get any points.
  • Testing runs you try yourself do not give an official grade; you'll need to submit and have me run them for that.
  • When testing on your own, you'll need to enable assertions. In the command line, you can do that with the -ea flag: java -ea ClassToExecute If you're using an IDE, you'll have to look online to figure out how to enable them.

Part 5, 0 points: You can start with the brute-force algorithm here, in order to earn some points and make sure you know how everything works.

Part 6, 0 points: In order to score all of the points, I think you will need to use dynamic programming. Here's a hint for your scheme: any time you choose to include a song, you have to skip the songs before and after it. Sometimes you won't want to skip just one song, but two. However, you will never want to skip three songs, as you could increase the length by including that song in the middle of those three. If you can't come up with the scheme, please come and talk to me so I can help you.

Part 7, 0 points: I did not get a speedup from using multiple processors for this project, but you are welcome to try using them.

Submitting your Project:

The files I'm looking for in this project are:

    Pick a team name (all alphabetical characters) for yourself that no one else will choose. (Using your names makes it easier for me, e.g. if I worked with Anne Borgin, our team name could be BorginAndBurke.) Put completed working files you have directly in a folder (no subfolders) named <YourTeamName>Project4, then zip the folder and upload the resulting .zip file to the assignment's canvas page so I can grade it. (E.g. BorginAndBurkeProject4.zip.) If you do it before the deadline and want me to run it through my tester to see how it does against the random players, send me a message and I'll do it. If you upload it after the deadline, please send me a message so I can grade it ASAP. Please please please name the folder correctly, then zip it; don't rename the zip file, or you'll have to resubmit and may incur a lateness penalty.