A Java 11 command-line application for managing student records in an AVL tree. It supports CRUD operations, UTF-8 CSV persistence, legacy course-file import, a corrected Quickselect implementation, and a reproducible comparison with an unbalanced binary search tree.
- AVL-backed lookup, insertion, update, deletion, and sorted listing
- CSV load and atomic save, including quoted fields and the original headerless field order
- Interactive CLI with input validation and explicit error messages
- Quickselect for finding the k-th largest integer without changing the input array
- Deterministic AVL/BST benchmark using a fixed data size and random seed
- JUnit coverage for rotations, root deletion, duplicate IDs, CSV errors, persistence, CLI flow, and Quickselect edge cases
- JDK 11 or newer
- No global Maven installation is required; the Maven Wrapper is included
On Windows:
./mvnw.cmd test
./mvnw.cmd package
java -jar target/avl-student-record-system-1.0.0.jar src/main/resources/students.csvOn macOS or Linux:
./mvnw test
./mvnw package
java -jar target/avl-student-record-system-1.0.0.jar src/main/resources/students.csvThe bundled CSV contains synthetic example records only. Starting without a file creates an empty in-memory store:
java -jar target/avl-student-record-system-1.0.0.jar| Command | Purpose |
|---|---|
load <csv-path> |
Replace the in-memory records after validating the complete file |
save <csv-path> |
Write sorted records through a temporary file and atomic replacement |
find <id> |
Find one student by ID |
add <id> <first> <last> <gender> <age> |
Add a record and reject duplicate IDs |
update <id> <first> <last> <gender> <age> |
Replace an existing record |
remove <id> |
Delete a record |
list [limit] |
List records in ascending ID order |
stats |
Show record count, tree height, and balance state |
kth <k> <value> [value ...] |
Find the k-th largest integer |
exit |
Close the CLI |
CLI names are whitespace-delimited. Names containing spaces or commas should be edited through CSV, where quoted fields are supported.
Run the deterministic comparison after compiling:
java -cp target/classes io.github.linkislethe.studentrecords.benchmark.TreeBenchmark 20000 20241215The recorded run and its limits are documented in docs/BENCHMARKS.md. The implementation details and tree invariants are in docs/ARCHITECTURE.md.
src/main/java/.../algorithm/ Quickselect
src/main/java/.../benchmark/ AVL/BST comparison
src/main/java/.../cli/ Interactive command interface
src/main/java/.../model/ Student record
src/main/java/.../persistence/ CSV reader and atomic writer
src/main/java/.../service/ Record operations
src/main/java/.../tree/ BST and AVL implementations
src/test/java/ JUnit tests
docs/ Architecture and benchmark notes
- Records are held in memory and persisted only when
saveis called. - The CLI is designed for one local process, without authentication or concurrent writes.
- The benchmark uses
System.nanoTime()rather than JMH; timing values are illustrative, while final tree height is deterministic for the supplied size and seed.
This repository is licensed under the MIT License.