Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
b7ba12d
feat(graphs): implement union-find and Dijkstra's algorithm with tests
AshishNevan Nov 18, 2025
c05ec9a
build(python): add ruff as dev dependency and update gitignore
AshishNevan Nov 18, 2025
da308d7
feat: Introduce core ADT implementations (Bags, Queues, Stacks, Linke…
AshishNevan Nov 20, 2025
449a196
feat: Introduce core ADT implementations (Bags, Queues, Stacks, Linke…
AshishNevan Nov 20, 2025
e271fcd
Merge branch 'port' of github.com:AshishNevan/DSAIPG into port
AshishNevan Nov 20, 2025
bf4a3a4
feat: Implement Run-Length Encoding, Huffman Coding, and Code Length …
AshishNevan Nov 20, 2025
22e0c9a
feat: add binary heap-based priority queue implementation with custom…
AshishNevan Nov 26, 2025
4dc4381
feat: Implement Symbol Table ADT with BST and hash table concrete typ…
AshishNevan Dec 4, 2025
ce62f1e
refactor: Replace placeholder implementations with `NotImplementedErr…
AshishNevan Dec 4, 2025
f804937
refactor: Replace placeholder `RuntimeError` and `pass`/`return None`…
AshishNevan Dec 4, 2025
7c5efbe
test: add comprehensive tests for base_immutable_symbol_table in adt/…
AshishNevan Dec 4, 2025
ab3dd20
feat: Implement the OrderedArray ADT with unit tests.
AshishNevan Dec 8, 2025
a4e10c9
refactor: Remove unused `Any`, `Generic`, and other typing and module…
AshishNevan Dec 8, 2025
7f10556
feat: add initial TwoFourTree data structure with unit tests
AshishNevan Jan 3, 2026
90e75a2
feat: add Trie (prefix tree) ADT implementation with tests and benchmark
AshishNevan Jan 3, 2026
23daf4b
fix: Dynamically resolve dictionary resource path relative to script …
AshishNevan Jan 3, 2026
6347e71
feat: introduce selection algorithms including quick select, slow sel…
AshishNevan Jan 3, 2026
7ea0ac7
build(python): make test collection independent of working directory
rchillyard Aug 24, 2026
7b07d47
test(python): assert what the exercises should do, not that they are …
rchillyard Aug 24, 2026
8b3dab7
fix(python): restore the two dropped exercises and repair dead imports
rchillyard Aug 24, 2026
23d3404
style(python): clean ruff, mostly by modernising type hints
rchillyard Aug 24, 2026
1e6e9dc
docs(python): write the missing build instructions, and add CI
rchillyard Aug 24, 2026
0ddac2c
Regenerate the Java tree from INFO6205, and move to Java 21
rchillyard Aug 24, 2026
6845ffd
Propagate the two assertion fixes from INFO6205
rchillyard Aug 24, 2026
2288599
Propagate CancelOnNotImplemented and the second swap guard
rchillyard Aug 24, 2026
73cf751
Propagate the growFrom change
rchillyard Aug 24, 2026
f7a8586
Propagate the 23 skeleton removals
rchillyard Aug 24, 2026
adfe35a
Propagate the last eight skeleton fixes
rchillyard Aug 24, 2026
18bfac6
Propagate the MSDStringSort memory-release move
rchillyard Aug 24, 2026
180de58
Delete two orphans, and reach a fully green student tree
rchillyard Aug 24, 2026
414e6ee
Delete the last two orphans
rchillyard Aug 24, 2026
de7f7a2
Propagate the Surefire pin and the cleaner skip message
rchillyard Aug 24, 2026
7cead8c
Report an unwritten Python exercise as skipped, not failed
rchillyard Aug 25, 2026
d757edd
Add Java CI
rchillyard Aug 25, 2026
748535c
Port util: Utilities, Statistics and StatPack
rchillyard Aug 25, 2026
d76757a
Propagate the three Java fixes, and match them in Python
rchillyard Aug 25, 2026
57e4c0c
Port util: Config, LazyLogger, Timer, Stopwatch and the Benchmark cla…
rchillyard Aug 25, 2026
0b0e0da
Match the Java fixes to Stopwatch, TimeLogger and LazyLogger
rchillyard Aug 26, 2026
096658c
Port sort foundations: Sort, Classifier, Instrument and Config_Benchmark
rchillyard Aug 26, 2026
af81e3b
Port the Helper hierarchy: Helper, BaseHelper and the two concrete He…
rchillyard Aug 26, 2026
4ae7bf4
Move msd_cutoff into BaseHelper, matching the Java
rchillyard Aug 26, 2026
57daa17
Port sort/elementary, part 1: the insertion sorts, bubble and selection
rchillyard Aug 26, 2026
5e50d00
Make swap_into_sorted stable, matching the Java
rchillyard Aug 26, 2026
831f6b7
Port sort/elementary, part 2: heap, shell, random and MSD insertion s…
rchillyard Aug 26, 2026
8f94443
HeapSort honours its range; RandomSort accepts an empty list
rchillyard Aug 26, 2026
940de06
Port sort/linearithmic, part 1: the quicksort family
rchillyard Aug 26, 2026
c543337
Port sort/linearithmic, part 2: the merge sorts
rchillyard Aug 26, 2026
e57a493
Port TimSort as a wrapper round Python's own sort
rchillyard Aug 26, 2026
c8c1490
Check the hit model against reality, which the Java tree cannot do
rchillyard Aug 26, 2026
1385077
Charge block moves and scans what they actually cost, matching the Java
rchillyard Aug 26, 2026
64d8f3f
Port sort/classic: Classify, ClassificationSorter, ClassicSort, Bucke…
rchillyard Aug 26, 2026
d9e3b71
BucketSort sorts a sub-range, matching the Java
rchillyard Aug 26, 2026
8aae61c
Port sort/counting: RadixSort, LSDStringSort, MSDStringSort
rchillyard Aug 26, 2026
8b5339f
RadixSort: make "to" exclusive, matching the Java
rchillyard Aug 26, 2026
3fca0ad
Port sort/par: parallel merge sort over processes
rchillyard Aug 26, 2026
d7ba5a0
Port adt/threesum to Python
rchillyard Aug 26, 2026
a1c6d0b
Port graphs/undirected: add Graph_Simple, fix two port defects, add 3…
rchillyard Aug 27, 2026
5128848
Let BagArray be constructed without _grow_from, and add BagArray.of
rchillyard Aug 27, 2026
1d11df0
Assert the growth contract directly, not only through add
rchillyard Aug 27, 2026
55e79d0
Regenerate the student Java tree from INFO6205
rchillyard Aug 27, 2026
c25c7a0
Port graphs/dag to Python
rchillyard Aug 27, 2026
495fab6
Port the DiGraph.reverse fix to Python, and regenerate the Java tree
rchillyard Aug 27, 2026
66ef384
Mirror the postProcess contract in Python, and regenerate the Java tree
rchillyard Aug 28, 2026
af74626
Regenerate the Java tree: config drift fix and ConfigFilesAgreeTest
rchillyard Aug 28, 2026
9aed62e
Phase 1 in Python, and regenerate the Java tree
rchillyard Aug 28, 2026
046fc3d
Regenerate the Java tree after folding ClassicHelper
rchillyard Aug 28, 2026
b0cf9cd
Sync as_array with the Java, and regenerate
rchillyard Aug 28, 2026
72ce54e
Regenerate the Java tree
rchillyard Aug 28, 2026
4608863
Regenerate after deleting ClassicHelper, and remove the two orphans
rchillyard Aug 28, 2026
db28022
Regenerate after the asArray change
rchillyard Aug 28, 2026
0682ab4
Regenerate the Java tree after finishing TimSort's instrumentation
rchillyard Aug 28, 2026
35b82ac
Regenerate the Java tree after Phase 3
rchillyard Aug 28, 2026
cfd3bfa
Port graphs/traversal to Python, collapsing two near-duplicate packages
rchillyard Aug 28, 2026
0ec5864
Port graphs/dynamicProgramming to Python
rchillyard Aug 28, 2026
192fd53
Regenerate after the BigInteger change; remove two orphans
rchillyard Aug 28, 2026
fd6b618
Port the graph-based Coins, and regenerate the Java tree
rchillyard Aug 28, 2026
1aec7a6
Port the graph-based Knapsack, and regenerate the Java tree
rchillyard Aug 28, 2026
d0c0f92
Port graphs/gis and graphs/tunnels
rchillyard Aug 28, 2026
5582929
Regenerate the Java tree
rchillyard Aug 28, 2026
0b0581e
Bring both READMEs up to date with the port
rchillyard Aug 28, 2026
a5e1340
Regenerate the Java tree
rchillyard Aug 28, 2026
6014134
Port misc/equable, misc/functions and misc/greedy
rchillyard Aug 29, 2026
b447a4c
Port the misc root classes
rchillyard Aug 29, 2026
adb5815
Port misc/reduction and misc/randomwalk
rchillyard Aug 29, 2026
5cf6ee8
Port misc/lab_1
rchillyard Aug 29, 2026
5182100
Finish misc: coupling, CallByValue and Patil
rchillyard Aug 29, 2026
014fbf1
Say what the code does, not what it used to do
rchillyard Aug 29, 2026
65d91b9
Finish the sweep: six more docstrings
rchillyard Aug 29, 2026
2a11e7f
Regenerate the Java tree
rchillyard Aug 29, 2026
f8dbd96
Sweep the rest of the archaeology, tests included
rchillyard Aug 29, 2026
f5efdb8
Eleven more, and this time the grep comes back empty
rchillyard Aug 29, 2026
203c1f7
Regenerate the Java tree
rchillyard Aug 29, 2026
2cd69eb
Port Moves2A, and bring Moves1 and Moves2 into line with the case study
rchillyard Aug 29, 2026
f34899b
Regenerate the Java tree
rchillyard Aug 29, 2026
2f09dff
Port projects/mcts, which completes the port
rchillyard Aug 29, 2026
37054c4
The READMEs no longer say the port is incomplete
rchillyard Aug 29, 2026
01f7ab0
Regenerate the Java tree
rchillyard Aug 30, 2026
06c6d2e
Record what the two-language comparison shows, and fix Huffman
rchillyard Aug 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 48 additions & 0 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Java

on:
push:
branches: [Fall2026, editionFirst]
pull_request:
workflow_dispatch:

defaults:
run:
working-directory: Java

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# 21 because pom.xml sets both maven.compiler.source and target to 21.
# Temurin rather than the runner's default so the version is pinned rather
# than inherited from whatever the image happens to ship.
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Compile, main and test sources
run: mvn -B test-compile

# A plain `mvn test` is a meaningful gate now that CancelOnNotImplemented
# reports an unwritten exercise as skipped rather than failed. Before that
# roughly a quarter of the suite was red by design, so the build could only
# ever be red and said nothing at all.
#
# Expect around 1208 tests: all passing, about 300 skipped. A skip names
# the file and line of the exercise it is waiting for; a failure is a real
# problem.
- name: Test
run: mvn -B test

- name: Publish the test report
if: always()
uses: actions/upload-artifact@v4
with:
name: surefire-reports
path: Java/target/surefire-reports/
if-no-files-found: warn
54 changes: 54 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Python

on:
push:
branches: [Fall2026, editionFirst]
pull_request:
workflow_dispatch:

defaults:
run:
working-directory: Python

jobs:
test:
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# 3.10 is the floor declared in pyproject.toml; 3.13 guards against
# anything that only works on the older interpreter.
python-version: ["3.10", "3.13"]
env:
# NOTE: this must be UV_PYTHON, not `uv sync --python`. The .python-version
# file pins 3.10, and `uv run` honours it even after `--python` built the
# environment against something else -- so passing the version as a flag
# silently tests 3.10 twice. UV_PYTHON takes precedence over the file.
UV_PYTHON: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v4

- uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Install dependencies
run: uv sync --locked

- name: Confirm the interpreter under test
run: uv run python -V

- name: Lint
run: uv run ruff check .

- name: Every module under src can be imported
run: uv run pytest test/test_imports.py -q

# A plain pytest is a meaningful gate now that conftest.py reports an
# unwritten exercise as skipped: red means a real failure, not coursework
# not yet done. Before that it was permanently red and said nothing, which
# is what tools/check_stub_failures.py existed to work around.
- name: Tests
run: uv run pytest -rs
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Compiled class file
*.class
/target/
**/target/

# Log filea
logs/
Expand All @@ -22,3 +22,13 @@ bin/*
*.kml

Java/src/test/java/edu/neu/coe/info6205/admin/TicketTest.java

# Python files
*.pyc
**/__pycache__/
*.pyo
**/.venv/
**/.pytest_cache/
**/.ruff_cache

.DS_Store
49 changes: 43 additions & 6 deletions Java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,37 @@
<version>1</version>
<build>
<plugins>
<plugin>
<!-- <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>17</source>
<target>18</target>
</configuration>
</plugin>
-->
<!--
Pinned because the version inherited from the super-POM is 2.12.4,
which dates from 2012 and reports a skipped test as a bare
<skipped/> with no message. CancelOnNotImplemented reports an
unwritten exercise as skipped, carrying the location of the work
("You need to implement the code at Bag_Array.java:187"), and that
message is the useful part. Surefire 3.x records it.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.source>1.17</maven.compiler.source>
<maven.compiler.target>1.18</maven.compiler.target>
<!-- NOTE: "21", not "1.21". javac only accepts the 1.x form up to 1.10;
anything later must be bare. With the compiler plugin commented out
above, these properties are what reach javac, so "1.21" fails the
build outright with "invalid target release: 1.21". -->
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
Expand All @@ -35,15 +53,34 @@
</repository>
</repositories>
<dependencies>
<!--
<dependency>
<groupId>com.phasmidsoftware</groupId>
<artifactId>gryphon_3</artifactId>
<version>1.3.0</version>
<scope>system</scope>
<systemPath>${user.home}/.m2/repository/com/phasmidsoftware/gryphon_3/1.3.0/gryphon_3-1.3.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.phasmidsoftware</groupId>
<artifactId>visitor_3</artifactId>
<version>1.5.0</version>
</dependency>
-->
<dependency>
<groupId>com.phasmidsoftware</groupId>
<artifactId>gryphon_3</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>com.phasmidsoftware</groupId>
<artifactId>args_2.13</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>com.phasmidsoftware</groupId>
<artifactId>number_2.13</artifactId>
<version>1.0.12</version>
<artifactId>number_3</artifactId>
<version>1.9.3</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down Expand Up @@ -104,4 +141,4 @@
</dependency>
-->
</dependencies>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ public void testIncrementVeryLargeCount() {
}
assertEquals((long) Integer.MAX_VALUE / 2, fc.get(key).intValue());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ public void runBenchmark(String description, Sort<Integer> sort, Helper<Integer>

private static Config config;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ static String[] getWords(final String resource, final Function<String, List<Stri
try {
final File file = new File(getPathname(resource, MSDStringSortFuncTest.class));
final String[] result = getWordArray(file, stringListFunction, 2);
System.out.println("getWords: testing with " + Utilities.formatWhole(result.length) + " unique words: from " + file);
System.out.println("getWords: testing with " + Utilities.formatWholeWithCommas(result.length) + " unique words: from " + file);
return result;
} catch (final FileNotFoundException e) {
System.out.println("Cannot find resource: " + resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,4 @@ private static <T extends Comparable<T>> Comparator<Object> getComparator() {
private Object[] array;

private int size;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ public Node(Value value, Key key1, Key key2, Key key3) {
// Node n = cf(key, node, node.key1, node.left);
// if (n)
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ public BQSException(String msg) {
public BQSException(Exception x) {
super(x);
}
}
}
23 changes: 21 additions & 2 deletions Java/src/main/java/com/phasmidsoftware/dsaipg/adt/bqs/Bag.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,29 @@ public interface Bag<Item> extends SizedIterable<Item> {
*
* @return this Bag as an array of Objects.
*/
Item[] asArray();
Object[] asArray();

/**
* Method to get this Bag as an array of the same component type as the one
* supplied.
* <p>
* The array carries the type information that {@link #asArray()} cannot: Item
* is erased, so there is nothing at runtime to say what kind of array to
* allocate, and the caller supplying one settles it. This is exactly
* {@link java.util.Collection#toArray(Object[])}, and for exactly the same
* reason — call it with {@code new Item[0]} to get a genuinely typed array
* back.
*
* @param a an array of the desired component type. It is filled and returned
* if it is big enough; otherwise a new one of the same type is
* allocated.
* @param <T> the component type.
* @return this Bag as an array of T.
*/
<T> T[] asArray(T[] a);

/**
* Empty out this Bag
*/
void clear();
}
}
Loading
Loading