# dksharma15/learning-java architecture

> Architecture diagram of the GitHub repository dksharma15/learning-java, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dksharma15/learning-java
- Repository: https://github.com/dksharma15/learning-java

## Overview

1. **Repository shape**
   - This is a **Java practice/workbook repo**, not a single cohesive application.
   - Source lives under `src`, compiled classes under `bin`, and the folder structure in `bin` mirrors the package layout in `src`.

2. **Primary architectural style**
   - The code is organized as a set of **independent classroom-style examples and interview problems**.
   - Most files are standalone classes, likely each with its own `main` method or self-contained demo logic.
   - There is **no shared service layer, persistence layer, or application framework**; the repo is mostly algorithmic exercises.

3. **Core subsystems by package**
   - `array`: 1D array fundamentals and common interview tasks.
   - `TwoDimensionalArray`: matrix operations and 2D traversal/transformation problems.
   - `methods`: basic Java method syntax and utility-style method examples.
   - `pattern`: console pattern-printing programs.
   - `string`: introductory string manipulation examples.
   - `string_and_stringbuilder`: string processing using both immutable `String` and mutable `StringBuilder`.

4. **Array subsystem**
   - Contains basics such as search, max/min, reverse, rotation, copying, passing arrays to methods, and second-largest element logic.
   - Includes problem-specific classes like `leetcode_TwoSum`, `leetcode_MergeSortedArray`, `leetcode_RotateArray`, and `leetcode_SortColor`.
   - This package is the main home for **1D data structure transformations**.

5. **Two-dimensional array subsystem**
   - Focuses on matrix-oriented operations: addition, transpose, in-place transpose, rotation, spiral traversal, wave traversal, and max search.
   - The data flow here is typically **matrix input → traversal/transformation → printed result**.
   - This package represents the repo’s **2D array algorithm boundary**.

6. **String and StringBuilder subsystems**
   - `string` covers basic string API usage: length, character access, substring, concatenation, interning, parsing, case conversion, search methods, vowels/digits, etc.
   - `string_and_stringbuilder` focuses on **mutation-oriented operations** such as reverse, toggle case, delete/insert, frequency counting, sorting, word reversal, and builder usage.
   - These packages highlight the boundary between **immutable string handling** and **mutable string construction**.

7. **Methods subsystem**
   - Contains foundational examples for method arguments, swapping, math utilities, and max-of-three logic.
   - This package is a learning layer for **how logic is factored into reusable methods**, but it does not appear to be shared infrastructure for the rest of the repo.

8. **Pattern-printing subsystem**
   - `pattern` contains classic console pattern programs: triangles, squares, rectangles, Floyd’s triangle, binary triangles, alphabet patterns, and star patterns.
   - The output is typically **direct console rendering**, with no data persistence or external interaction.
   - These classes are visually oriented and separate from the array/string problem-solving code.

9. **External dependencies and runtime**
   - The repo appears to rely only on the **standard Java runtime**.
   - There is no evidence of third-party libraries, databases, network services, or build tooling beyond the VS Code Java project setup.
   - The workspace is configured for **plain Java compilation/execution** in VS Code.

10. **Execution model and data flow**
   - Each example class is effectively its own mini-program: read input if needed, perform a transformation, print the result.
   - Inputs are mostly hardcoded or console-driven; outputs are primarily console prints for learning and verification.
   - There is no shared domain model or cross-package orchestration.

11. **Naming and organization characteristics**
   - File names are descriptive of the algorithm or concept being demonstrated, including LeetCode-style problem names.
   - The repo is structured for **topic-based navigation**, not layered application architecture.
   - The package boundaries are mainly educational rather than functional components of a larger system.

12. **How to diagram it**
   - A good architecture diagram would show:
     - `src` as the source root
     - six topic packages as independent modules
     - `bin` as compiled output
     - a shared dependency on the Java standard library
   - The most accurate mental model is **a collection of standalone algorithm demos grouped by topic**, not an integrated product.

Main entry points: [`src`](https://github.com/dksharma15/learning-java/tree/main/src) (src), [`bin`](https://github.com/dksharma15/learning-java/tree/main/bin) (bin), [`src/array`](https://github.com/dksharma15/learning-java/tree/main/src/array) (Array), [`src/TwoDimensionalArray`](https://github.com/dksharma15/learning-java/tree/main/src/TwoDimensionalArray) (2D Array)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_source["Source"]
  node_src["src<br/>source root"]
  node_array_src["Array<br/>1D algorithms"]
  node_matrix_src["2D Array<br/>matrix algorithms"]
  node_methods_src["Methods<br/>method basics"]
  node_pattern_src["Pattern"]
  node_string_src["String"]
  node_sb_src["StringBuilder<br/>mutable strings"]
  node_array_algos["Core Arrays<br/>algorithms"]
  node_array_problems["LeetCode Arrays<br/>problem set"]
  node_matrix_ops["Matrix Ops<br/>traversal/transforms"]
  node_string_api["String API<br/>immutable ops"]
  node_sb_ops["Builder Ops<br/>mutable ops"]
end

subgraph group_build["Build Output"]
  node_bin["bin<br/>compiled output"]
  node_array_bin["array<br/>compiled package"]
  node_matrix_bin["TwoDimensionalArray<br/>compiled package"]
  node_methods_bin["methods<br/>compiled package"]
  node_pattern_bin["pattern<br/>compiled package"]
  node_string_bin["string<br/>compiled package"]
  node_sb_bin["string_and_stringbuilder<br/>compiled package"]
end

subgraph group_runtime["Runtime"]
  node_java(("Java SE<br/>stdlib"))
end

node_src -->|"contains"| node_array_src
node_src -->|"contains"| node_matrix_src
node_src -->|"contains"| node_methods_src
node_src -->|"contains"| node_pattern_src
node_src -->|"contains"| node_string_src
node_src -->|"contains"| node_sb_src
node_array_src -->|"organizes"| node_array_algos
node_array_src -->|"organizes"| node_array_problems
node_matrix_src -->|"organizes"| node_matrix_ops
node_string_src -->|"organizes"| node_string_api
node_sb_src -->|"organizes"| node_sb_ops
node_bin -->|"mirrors"| node_array_bin
node_bin -->|"mirrors"| node_matrix_bin
node_bin -->|"mirrors"| node_methods_bin
node_bin -->|"mirrors"| node_pattern_bin
node_bin -->|"mirrors"| node_string_bin
node_bin -->|"mirrors"| node_sb_bin
node_array_src -->|"uses"| node_java
node_matrix_src -->|"uses"| node_java
node_methods_src -->|"uses"| node_java
node_pattern_src -->|"uses"| node_java
node_string_src -->|"uses"| node_java
node_sb_src -->|"uses"| node_java

click node_src "https://github.com/dksharma15/learning-java/tree/main/src"
click node_bin "https://github.com/dksharma15/learning-java/tree/main/bin"
click node_array_src "https://github.com/dksharma15/learning-java/tree/main/src/array"
click node_matrix_src "https://github.com/dksharma15/learning-java/tree/main/src/TwoDimensionalArray"
click node_methods_src "https://github.com/dksharma15/learning-java/tree/main/src/methods"
click node_pattern_src "https://github.com/dksharma15/learning-java/tree/main/src/pattern"
click node_string_src "https://github.com/dksharma15/learning-java/tree/main/src/string"
click node_sb_src "https://github.com/dksharma15/learning-java/tree/main/src/string_and_stringbuilder"
click node_array_bin "https://github.com/dksharma15/learning-java/tree/main/bin/array"
click node_matrix_bin "https://github.com/dksharma15/learning-java/tree/main/bin/TwoDimensionalArray"
click node_methods_bin "https://github.com/dksharma15/learning-java/tree/main/bin/methods"
click node_pattern_bin "https://github.com/dksharma15/learning-java/tree/main/bin/pattern"
click node_string_bin "https://github.com/dksharma15/learning-java/tree/main/bin/string"
click node_sb_bin "https://github.com/dksharma15/learning-java/tree/main/bin/string_and_stringbuilder"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_src,node_array_src,node_matrix_src,node_methods_src,node_pattern_src,node_string_src,node_sb_src,node_array_algos,node_array_problems,node_matrix_ops,node_string_api,node_sb_ops toneBlue
class node_bin,node_array_bin,node_matrix_bin,node_methods_bin,node_pattern_bin,node_string_bin,node_sb_bin toneAmber
class node_java toneMint
```

## Components

### Source

Java source tree

- [src](https://github.com/dksharma15/learning-java/tree/main/src): source root · Source root for all examples · `src`
- [Array](https://github.com/dksharma15/learning-java/tree/main/src/array): 1D algorithms · One-dimensional array basics and interview problems · `src/array`
- [2D Array](https://github.com/dksharma15/learning-java/tree/main/src/TwoDimensionalArray): matrix algorithms · Matrix traversal and transformation examples · `src/TwoDimensionalArray`
- [Methods](https://github.com/dksharma15/learning-java/tree/main/src/methods): method basics · Method arguments, swapping, and utility examples · `src/methods`
- [Pattern](https://github.com/dksharma15/learning-java/tree/main/src/pattern): console patterns · Star, number, and alphabet pattern programs · `src/pattern`
- [String](https://github.com/dksharma15/learning-java/tree/main/src/string): string basics · Immutable string API and parsing examples · `src/string`
- [StringBuilder](https://github.com/dksharma15/learning-java/tree/main/src/string_and_stringbuilder): mutable strings · Mutable string operations and builder-based exercises · `src/string_and_stringbuilder`
- **Core Arrays**: algorithms · Search, max/min, reverse, rotation, copying, and second-largest logic
- **LeetCode Arrays**: problem set · Two Sum, merge, rotate, and color-sorting exercises
- **Matrix Ops**: traversal/transforms · Addition, transpose, rotation, spiral, and wave traversal
- **String API**: immutable ops · Length, substring, search, case conversion, and parsing
- **Builder Ops**: mutable ops · Reverse, toggle, delete/insert, frequency, and word handling

### Build Output

Compiled class tree

- [bin](https://github.com/dksharma15/learning-java/tree/main/bin): compiled output · Compiled classes mirrored by package · `bin`
- [array](https://github.com/dksharma15/learning-java/tree/main/bin/array): compiled package · Compiled classes for array exercises · `bin/array`
- [TwoDimensionalArray](https://github.com/dksharma15/learning-java/tree/main/bin/TwoDimensionalArray): compiled package · Compiled classes for matrix exercises · `bin/TwoDimensionalArray`
- [methods](https://github.com/dksharma15/learning-java/tree/main/bin/methods): compiled package · Compiled classes for method examples · `bin/methods`
- [pattern](https://github.com/dksharma15/learning-java/tree/main/bin/pattern): compiled package · Compiled classes for pattern programs · `bin/pattern`
- [string](https://github.com/dksharma15/learning-java/tree/main/bin/string): compiled package · Compiled classes for string examples · `bin/string`
- [string_and_stringbuilder](https://github.com/dksharma15/learning-java/tree/main/bin/string_and_stringbuilder): compiled package · Compiled classes for builder-based string exercises · `bin/string_and_stringbuilder`

### Runtime

Standard Java APIs

- **Java SE**: stdlib · Standard Java runtime APIs

## Connections

- src → Array: contains · Source package for one-dimensional array exercises
- src → 2D Array: contains · Source package for 2D array exercises
- src → Methods: contains · Source package for method examples
- src → Pattern: contains · Source package for pattern-printing examples
- src → String: contains · Source package for string basics
- src → StringBuilder: contains · Source package for StringBuilder exercises
- Array → Core Arrays: organizes · Core array manipulation exercises
- Array → LeetCode Arrays: organizes · Standalone interview-style array problems
- 2D Array → Matrix Ops: organizes · Matrix traversal and transformation routines
- String → String API: organizes · Immutable string handling examples
- StringBuilder → Builder Ops: organizes · Mutable string construction and mutation examples
- bin → array: mirrors · Compiled output for array package
- bin → TwoDimensionalArray: mirrors · Compiled output for 2D array package
- bin → methods: mirrors · Compiled output for methods package
- bin → pattern: mirrors · Compiled output for pattern package
- bin → string: mirrors · Compiled output for string package
- bin → string_and_stringbuilder: mirrors · Compiled output for StringBuilder package
- Array → Java SE: uses · Standard Java runtime and console I/O
- 2D Array → Java SE: uses · Standard Java runtime and console I/O
- Methods → Java SE: uses · Standard Java runtime and console I/O
- Pattern → Java SE: uses · Standard Java runtime and console I/O
- String → Java SE: uses · Standard Java runtime and console I/O
- StringBuilder → Java SE: uses · Standard Java runtime and console I/O
