These exercises give you a taster of multi-dimensional arrays, combine static methods with instance methods, show you how to use external third party libraries and the basics of file system paths.
Note
In order to carry out some of these exercises, you will need classes from a third-party library called stdlib developed by Sedgewick & Wayne:
You might find it useful to browse the documentation of corresponding library classes when you have to use them.
Third party library classes are usually bundled together in a java archive file or jar-file.
If you are using a Java project in IntelliJ
You will have to download the stdlib.jar manually and include it into your IntelliJ project following these steps:
- Select File from the main menu bar
- Select Project Structure ...
- Select Modules under Project Settings on the left
- Open the Dependencies tab
- Click the + sign on the right
- Select JARs or directories ...
- In the new menu, find your downloaded stdlib.jar, select it and press ok (you might need to refresh the directory structure by clicking the circular refresh button in the top menu.)
If you are using a Gradle project in IntelliJ
You do not need to download the files yourself, they are instead offered via an online repository called Maven. To include the stdlib into your Gradle project, do the following:
- Open the file build.gradle
- Add a line for stdlib in the dependencies section under the dependencies for JUnit:
- Now select the circular refresh button in the gradle panel on the right or select import changes from the pop up message to integrate the new library into your IntelliJ project.
dependencies { compile group: 'com.googlecode.princeton-java-introduction', name: 'stdlib', version: '1.0.1' }
Difficulty | Question | Description |
---|---|---|
warmup | Q1 | No Triples (Pair Programming) |
Q2 | Has 271 | |
Q3 | Nesting Nightmare | |
core | Q4 | N-by-N Matrix |
Q5 | Path Names | |
Q6 | Voronoi Diagram (Pair Programming) |