This repository contains a set of small Java exercises (originally authored for BlueJ) used for learning basic algorithms, data structures and small program architecture. Each exercise is contained in its own folder under exercises/ and is self-contained: source files, BlueJ metadata and short notes (where available).
The exercises include simple linked-list implementations, the N-Queens problem, a bottom-up LIS implementation, a 15-puzzle project, and a Huffman coding example among others. The codebase is intended for learning and experimenting, not production use.
exercises/— top-level folder containing numbered exercise folders (es_1..es_8).es_1/— simple string list (StringSList) and a starter driver.es_2/— integer list (IntSList) and aRoundTableexample with a test driver.es_3/— N-Queens solver withBoardand helper list utilities.es_4/— another N-Queens variant and anSListimplementation; includes aqueens/subfolder.es_5/— small single-file exercise (es5.java).es_6/—BottomUpLISimplementation (dynamic programming example).es_7/— 15-puzzle implementation (puzzle15andView) and generated Javadoc indoc/.es_8/— Huffman coding implementation withNode,NodeQueue,NodeStackand sample inputsC.txt/D.txt.
Each es_* folder now includes a README.md that explains the files inside, how to compile/run them and testing tips. Open the folder and read that file for exercise-specific guidance.
Open a terminal (WSL is fine on Windows) and change into the exercise folder you want to run. For example, to work on es_3:
cd exercises/es_3Compile all Java files in that folder:
javac *.javaRun the driver (replace MainClass with the public class that contains main, usually the filename without .java):
java MainClassExamples
- If
Queens.javais the driver ines_3, run:
java Queens- For the Huffman example in
es_8, the program may accept a filename argument. Try:
cd exercises/es_8
javac *.java
java Huffman C.txtIf you see compilation errors about package declarations, open the .java files and either adjust the package lines to match directories or remove the package line for quick command-line compilation.
These exercises were originally created in BlueJ and include .ctxt and package.bluej files. To use BlueJ:
- Open BlueJ and choose
Open Project→ select anes_*folder. - BlueJ will show classes visually and allow running
mainmethods or calling individual methods interactively.
BlueJ is convenient for stepping through small programs and inspecting object state during execution.