Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ to identify connected components.
Each bounding box is defined by the minimum and maximum `x` and `y` coordinates
(with 1-based indexing) that surround a connected group of `*` characters.

See detailed article: [2D Matrix Bounding Box Checker Using DSU and Union-Find in Java 23 Using TDD](https://unnsse.io/2025/05/boundingbox_05032025)

### Example Input

```txt
Expand All @@ -26,14 +28,22 @@ Each bounding box is defined by the minimum and maximum `x` and `y` coordinates

## Features

• Detects all connected components of `*` characters using Union-Find.
• Reads input text file containing 2D grid from `stdin`.

• Detects all connected components of `*` characters using Disjoint Set Union-Find (DSU).

• Calculates bounding box coordinates during the find-union phase.

• Computes the minimum bounding box for each component.

• Filters for the largest non-overlapping bounding box.

• Filters and compares boxes using area and coordinates.

• Optionally returns all non-overlapping boxes in sorted order.

• Returns empty string if no valid boxes found.

• Handles malformed input with a clear "Error" output.

• Efficient for large grids (10,000 × 10,000).
Expand All @@ -42,16 +52,6 @@ See [Requirements.md](Requirements.md) for more details.

---

## Design/Implementation

• Uses a Union-Find (DisjointSet) to track connected components of `*`.

• Calculates bounding box coordinates during the find-union phase.

• Filters and compares boxes using area and coordinates.

---

## Machine / Target Environment

Local / target machine should have the following software installed:
Expand Down Expand Up @@ -103,12 +103,4 @@ new BoundingBox().largestNonOverlappingBox(lines, true);

---

## Article/Blog Entry

Wrote detailed article about this experience in my blog:

[2D Matrix Bounding Box Checker Using DSU and Union-Find in Java 23 Using TDD](https://unnsse.io/2025/05/boundingbox_05032025)

---

Feel free to fork and/or add to this!! :smile: :coffee: