# ganth1811/sorting-algorithm-comparison architecture

> Architecture diagram of the GitHub repository ganth1811/sorting-algorithm-comparison, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ganth1811/sorting-algorithm-comparison
- Repository: https://github.com/ganth1811/sorting-algorithm-comparison

## Overview

##### Main Components
- Data Generator: Represented by DataGenerator.cpp and DataGenerator.h. This module is responsible for creating test data of various sizes and orders.
- Sorting Algorithms: Each sorting algorithm has its own source file (e.g., bubble_sort.cpp, quick_sort.cpp, merge_sort.cpp, etc.). These implement the different sorting techniques. The common interface in sorting_algorithm.h suggests that they share a unified API or structure.
- Program Orchestration: main.cpp, program.cpp, and program.h likely serve as the entry point and coordination logic that calls the data generator and the sorting routines, measures performance, and maybe logs results.
- Project Notes & Documentation: The “Project Note” folder contains supplementary documentation (like the ProjectDescription.pdf), which can inform additional context or constraints for the design.

##### Relationships and Interactions
- The Program Orchestration sits at the center, receiving test parameters from the user (or pre-defined tests), then invoking the Data Generator to create datasets.
- Once data is created, the orchestration layer iteratively sends the data to each sorting algorithm implementation (using a common interface as defined by sorting_algorithm.h) and collects performance metrics.
- The various sorting modules (each sorting algorithm) can be seen as interchangeable or plug-in components used by the main control flow.

##### Architectural Patterns
- Modular Design: Each sorting algorithm and the data generator are developed as separate modules, which makes it easy to add or remove implementations.
- Interface Abstraction: The use of sorting_algorithm.h implies that each algorithm conforms to a standard interface, allowing the orchestration module to interact with them polymorphically.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Main Modules
    Controller["Controller / Main Program"]:::controller
    DataGen["Data Generation Module"]:::generation
    Results["Results / Metrics Collector"]:::controller
    Doc["Documentation & Project Notes"]:::doc

    %% Sorting Algorithms Subgraph
    subgraph "Sorting Algorithms"
        Interface["Sorting Algorithms Interface"]:::sortingInterface
        Bubble["Bubble Sort"]:::sorting
        Quick["Quick Sort"]:::sorting
        Merge["Merge Sort"]:::sorting
        Insertion["Insertion Sort"]:::sorting
        Selection["Selection Sort"]:::sorting
        Heap["Heap Sort"]:::sorting
        Counting["Counting Sort"]:::sorting
        Radix["Radix Sort"]:::sorting
        Shaker["Shaker Sort"]:::sorting
        Shell["Shell Sort"]:::sorting
        Flash["Flash Sort"]:::sorting
    end

    %% Interactions
    Controller -->|"GenerateTestData"| DataGen
    Controller -->|"SortDataUsingInterface"| Interface
    Interface -->|"Executes"| Bubble
    Interface -->|"Executes"| Quick
    Interface -->|"Executes"| Merge
    Interface -->|"Executes"| Insertion
    Interface -->|"Executes"| Selection
    Interface -->|"Executes"| Heap
    Interface -->|"Executes"| Counting
    Interface -->|"Executes"| Radix
    Interface -->|"Executes"| Shaker
    Interface -->|"Executes"| Shell
    Interface -->|"Executes"| Flash
    Controller -->|"CollectMetrics"| Results
    Controller ---|"RefDocumentation"| Doc

    %% Click Events
    click DataGen "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/DataGenerator.cpp"
    click Controller "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/main.cpp"
    click Interface "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/sorting_algorithm.h"
    click Bubble "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/bubble_sort.cpp"
    click Quick "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/quick_sort.cpp"
    click Merge "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/merge_sort.cpp"
    click Insertion "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/insertion_sort.cpp"
    click Selection "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/selection_sort.cpp"
    click Heap "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/heap_sort.cpp"
    click Counting "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/counting_sort.cpp"
    click Radix "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/radix_sort.cpp"
    click Shaker "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/shaker_sort.cpp"
    click Shell "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/shell_sort.cpp"
    click Flash "https://github.com/ganth1811/sorting-algorithm-comparison/blob/main/flash_sort.cpp"
    click Doc "https://github.com/ganth1811/sorting-algorithm-comparison/tree/main/Project Note"

    %% Styles
    classDef controller fill:#FDEBD0,stroke:#D35400,stroke-width:2px;
    classDef generation fill:#D6EAF8,stroke:#2E86C1,stroke-width:2px;
    classDef sorting fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef sortingInterface fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef doc fill:#FCF3CF,stroke:#B7950B,stroke-width:2px;
```
