# uitxwoodynguyen/sorting-algo-analyzing architecture

> Architecture diagram of the GitHub repository uitxwoodynguyen/sorting-algo-analyzing, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/uitxwoodynguyen/sorting-algo-analyzing
- Repository: https://github.com/uitxwoodynguyen/sorting-algo-analyzing

## Overview

This is a C++ sorting-algorithm analysis project: users can sort data, generate test datasets, run known-answer tests and benchmarks, and inspect runtime charts and tables. The principal workflow is CLI input through shared format handling and algorithm dispatch to a selected sorter, then sorted output. Separate branches cover dataset generation, validation, benchmarking, and plotting; the GUI launches the CLI. The README documents several links not shown in source excerpts, so those are cited to the README; unsampled implementation details are not inferred.

Main entry points: [`src/sort_common.hpp`](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/sort_common.hpp) (Format and dispatch), [`src/bench.cpp`](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/bench.cpp) (Benchmark runner), [`src/main.cpp`](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/main.cpp) (CLI entry), [`src/kat.cpp`](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/kat.cpp) (Known-answer tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interfaces"]
  node_gui["Desktop GUI<br/>[sortapp_gui.py]"]
  node_cli["CLI entry<br/>[main.cpp]"]
end

subgraph group_sorting["Sorting runtime"]
  node_common["Format and dispatch<br/>[sort_common.hpp]"]
  node_insertion["Insertion sort<br/>[insertion-sort.cpp]"]
  node_selection["Selection sort<br/>[selection-sort.cpp]"]
  node_heap["Heap sort<br/>[heap-sort.cpp]"]
  node_merge["Merge sort<br/>[merge-sort.cpp]"]
  node_quick["Quick sort<br/>[quick-sort.cpp]"]
  node_walkthrough["Step walkthroughs"]
end

subgraph group_validation["Testing and benchmarks"]
  node_kat["Known-answer tests<br/>[kat.cpp]"]
  node_vectors["Test vectors<br/>[vectors.json]"]
  node_benchmark["Benchmark runner<br/>[bench.cpp]"]
end

subgraph group_analysis["Data and analysis"]
  node_generator["Dataset generator<br/>[generator.cpp]"]
  node_inputs[("Input datasets")]
  node_expected[("Expected outputs")]
  node_csv["Runtime records<br/>[benchmark.csv]"]
  node_plotter["Charts and tables<br/>[plot_bench.py]"]
  node_reports["Analysis outputs"]
end

node_user(("User"))

node_user -->|"runs"| node_cli
node_user -->|"uses"| node_gui
node_gui -->|"launches"| node_cli
node_cli -->|"reads and sorts"| node_common
node_common -->|"dispatches"| node_insertion
node_common -->|"dispatches"| node_selection
node_common -->|"dispatches"| node_heap
node_common -->|"dispatches"| node_merge
node_common -->|"dispatches"| node_quick
node_user -->|"generates data"| node_generator
node_generator -->|"writes inputs"| node_inputs
node_generator -->|"writes expected"| node_expected
node_cli -->|"delegates benchmark"| node_benchmark
node_benchmark -->|"reads cases"| node_inputs
node_benchmark -->|"checks results"| node_expected
node_benchmark -->|"runs algorithms"| node_common
node_benchmark -->|"writes timings"| node_csv
node_cli -->|"delegates tests"| node_kat
node_kat -->|"runs sorts"| node_common
node_kat -->|"loads cases"| node_vectors
node_user -->|"creates reports"| node_plotter
node_plotter -->|"reads timings"| node_csv
node_plotter -->|"writes charts and tables"| node_reports

click node_gui "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/gui/sortapp_gui.py"
click node_cli "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/main.cpp"
click node_common "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/sort_common.hpp"
click node_insertion "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/insertion-sort.cpp"
click node_selection "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/selection-sort.cpp"
click node_heap "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/heap-sort.cpp"
click node_merge "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/merge-sort.cpp"
click node_quick "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/quick-sort.cpp"
click node_walkthrough "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/sort-step-by-step.cpp"
click node_generator "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/dataset/generator.cpp"
click node_inputs "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/tree/main/dataset/input"
click node_expected "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/tree/main/dataset/output"
click node_kat "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/kat.cpp"
click node_vectors "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/test-vector/vectors.json"
click node_benchmark "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/bench.cpp"
click node_csv "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/Output/benchmark.csv"
click node_plotter "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/scripts/plot_bench.py"
click node_reports "https://github.com/uitxwoodynguyen/sorting-algo-analyzing/tree/main/Output"

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_gui,node_cli,node_user toneBlue
class node_common,node_insertion,node_selection,node_heap,node_merge,node_quick,node_walkthrough toneAmber
class node_kat,node_vectors,node_benchmark toneMint
class node_generator,node_inputs,node_expected,node_csv,node_plotter,node_reports toneRose
```

## Components

### User interfaces

- [Desktop GUI](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/gui/sortapp_gui.py): `gui/sortapp_gui.py`
- [CLI entry](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/main.cpp): `src/main.cpp`

### Sorting runtime

- [Format and dispatch](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/sort_common.hpp): `src/sort_common.hpp`
- [Insertion sort](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/insertion-sort.cpp): `src/insertion-sort.cpp`
- [Selection sort](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/selection-sort.cpp): `src/selection-sort.cpp`
- [Heap sort](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/heap-sort.cpp): `src/heap-sort.cpp`
- [Merge sort](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/merge-sort.cpp): `src/merge-sort.cpp`
- [Quick sort](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/quick-sort.cpp): `src/quick-sort.cpp`
- [Step walkthroughs](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/sort-step-by-step.cpp): `src/sort-step-by-step.cpp`

### Testing and benchmarks

- [Known-answer tests](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/kat.cpp): `src/kat.cpp`
- [Test vectors](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/test-vector/vectors.json): `test-vector/vectors.json`
- [Benchmark runner](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/src/bench.cpp): `src/bench.cpp`

### Data and analysis

- [Dataset generator](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/dataset/generator.cpp): `dataset/generator.cpp`
- [Input datasets](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/tree/main/dataset/input): `dataset/input`
- [Expected outputs](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/tree/main/dataset/output): `dataset/output`
- [Runtime records](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/Output/benchmark.csv): `Output/benchmark.csv`
- [Charts and tables](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/blob/main/scripts/plot_bench.py): `scripts/plot_bench.py`
- [Analysis outputs](https://github.com/uitxwoodynguyen/sorting-algo-analyzing/tree/main/Output): `Output`

### Other components

- **User**

## Connections

- User → CLI entry: runs (evidence: `README.md`)
- User → Desktop GUI: uses (evidence: `README.md`)
- Desktop GUI → CLI entry: launches (evidence: `README.md`)
- CLI entry → Format and dispatch: reads and sorts (evidence: `src/main.cpp`)
- Format and dispatch → Insertion sort: dispatches (evidence: `src/sort_common.hpp`)
- Format and dispatch → Selection sort: dispatches (evidence: `src/sort_common.hpp`)
- Format and dispatch → Heap sort: dispatches (evidence: `src/sort_common.hpp`)
- Format and dispatch → Merge sort: dispatches (evidence: `src/sort_common.hpp`)
- Format and dispatch → Quick sort: dispatches (evidence: `src/sort_common.hpp`)
- User → Dataset generator: generates data (evidence: `README.md`)
- Dataset generator → Input datasets: writes inputs (evidence: `README.md`)
- Dataset generator → Expected outputs: writes expected (evidence: `README.md`)
- CLI entry → Benchmark runner: delegates benchmark (evidence: `src/main.cpp`)
- Benchmark runner → Input datasets: reads cases (evidence: `README.md`)
- Benchmark runner → Expected outputs: checks results (evidence: `README.md`)
- Benchmark runner → Format and dispatch: runs algorithms (evidence: `README.md`)
- Benchmark runner → Runtime records: writes timings (evidence: `README.md`)
- CLI entry → Known-answer tests: delegates tests (evidence: `src/main.cpp`)
- Known-answer tests → Format and dispatch: runs sorts (evidence: `src/kat.cpp`)
- Known-answer tests → Test vectors: loads cases (evidence: `README.md`)
- User → Charts and tables: creates reports (evidence: `README.md`)
- Charts and tables → Runtime records: reads timings (evidence: `README.md`)
- Charts and tables → Analysis outputs: writes charts and tables (evidence: `README.md`)
