Getting setup, refreshing CSE 143 concepts, and running unit tests.

Learning Goals

  • Refresh CSE 143 concepts and set the expectations for homework in CSE 332.

    This homework is an introduction to what we’ll be doing in this class: working with data structures and algorithms. Throughout this class, we will be implementing and using data structures that are similar to or build off of those introduced in CSE 143.

  • Set up IntelliJ and other systems we’ll use in this class (Java, GitLab, Git, Checkstyle).

    These tools (or very similar ones) are commonly used in industry and in everyday programming. Even if we don’t end up mastering these by the end of CSE 332, some familiarity and exposure will be helpful for future programming.

  • Learn how to use JUnit and run unit tests in IntelliJ.

    We’ll be using JUnit as a tool for communicating homework specifications and for grading, so it’s important to learn how to use it. Unit testing allows us to build confidence in the correctness of our code, especially as we work on larger and larger programs.

Table of contents

  1. Getting Started
    1. Version Control
  2. Programming
    1. firstToLast
    2. extend
    3. concatenated
  3. Submission

Getting Started

  1. Set up your computer for programming in CSE 332.
  2. Learn how to use IntelliJ to write code, debug programs, and run tests.

Version Control

While tools like Google Docs autosave every change, Git requires us to commit our changes manually. After implementing each method, make a commit by tapping the green checkmark icon in the Navigation bar or through the VCS menu item. You’ll have the option of reviewing your changes to ensure that the commit you’re about to make contains exactly what you want to include.

When you make a commit, IntelliJ can also run some basic checks for you, including reformatting code to pass indentation and spacing style guidelines. In the Git commit dialog window, make sure the following checkboxes under Before Commit are ticked.

  • Reformat code
  • Perform code analysis
  • Check TODO (Show All)
  • Scan with Checkstyle

Once you’ve committed your changes, you’ll also need to push them to your personal GitLab repository. Read the IntelliJ documentation on how to commit and push changes for more information.


This homework assignment consists of implementing three methods for the LinkedIntList class. All the graded tests are provided to you in the LinkedIntListTest class.

Take a look around the LinkedIntList class before you begin programming. We’ve provided a couple examples: three ways of squaring all of the items in a list. Understanding these examples will help when it comes to solving the problems in this assignment. Try using the Java Visualizer to display the state of the program as it runs.


Implement a method, void firstToLast(LinkedIntList L), that moves the first element of the list L to the back end of the list.

LinkedIntList L: front → 18 → 4 → 27 → 9 → 54 → 5 → 63 → /
 firstToLast(L): void
              L: front → 4 → 27 → 9 → 54 → 5 → 63 → 18 → /

If the list is empty or has just one element, its contents should not be modified.

Once you’ve passed the tests for firstToLast, commit and push changes. It’s good to get in the habit of committing frequently, especially before experimenting with a new idea. Each commit is a snapshot that we can restore at a later time. Try committing your changes with the following message.

intlist: Implement LinkedIntList.firstToLast


Implement a method, void extend(LinkedIntList A, LinkedIntList B), that adds all of the items in B to the end of A without using the new keyword or creating new nodes.

LinkedIntList A: front → 1 → 2 → 3 → /
LinkedIntList B: front → 4 → 5 → 6 → /
   extend(A, B): void
              A: front → 1 → 2 → 3 → 4 → 5 → 6 → /
              B: front → 4 → 5 → 6 → /

Once you’ve passed the tests for extend, commit and push changes.


Implement a method, LinkedIntList concatenated(LinkedIntList A, LinkedIntList B), that is similar to extend but rather than modifying A instead returns a new list that contains all of the items in A followed by all of the items in B. Don’t modify A or B; use the new keyword to create new nodes.

   LinkedIntList A: front → 1 → 2 → 3 → /
   LinkedIntList B: front → 4 → 5 → 6 → /
concatenated(A, B): front → 1 → 2 → 3 → 4 → 5 → 6 → /
                 A: front → 1 → 2 → 3 → /
                 B: front → 4 → 5 → 6 → /

Once you’ve passed the tests for concatenated, commit and push changes.


The last step is to submit your work to Gradescope. Gradescope is the site that you’ll use to submit homework assignments and view all of the graded work in this course, including scores and feedback on your homework, weekly QuickChecks, the Midterm Exam, and the Final Exam. You should already have access to Gradescope via an email sent to your address. If you don’t have access, use the Gradescope sign-up form to signup with your email address and paste the entry code posted on Piazza.

We don’t actually submit assignments directly to Gradescope. Instead, Gradescope will clone your personal GitLab repository. Your class should contain implementations for each of the following methods.

From the CSE 332 Gradescope, tap on the HW 1: LinkedIntList assignment. In the pop-up that appears, choose the GitLab button at the bottom. Find your repository in the list and Submit Project. Leave the branch on master.

Once you submit your work, you’ll be shown a waiting page while Gradescope grades your submission. After about a couple minutes, the autograder will finish running your code and automatically update the page with the test output and your overall assignment score. If there’s an infinite loop in the code, the autograder will continue running for about 10 minutes before giving up and reporting a timeout.

For this assignment, the tests on Gradescope are the same tests you can run in IntelliJ. You can submit your work to Gradescope as many times as you like. You can even submit before you’re done with the homework to get immediate feedback. If you make more than one submission, you can mark the submission you’d like to use as your final score. The final score on Gradescope is the score you will receive on the assignment.