# sergiocalde/binarysearch-quicksortjs architecture

> Architecture diagram of the GitHub repository sergiocalde/binarysearch-quicksortjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sergiocalde/binarysearch-quicksortjs
- Repository: https://github.com/sergiocalde/binarysearch-quicksortjs

## Overview

##### Project Type and Purpose
- This is a small, static single-page web application whose sole purpose is to demonstrate two core algorithms: Quicksort and Binary Search.
- There is no “backend” or database; the entire system runs in the user’s browser, with static assets served by a simple web server or CDN.

##### File-Structure Analysis
- Top level:
- index.html – the entry point and UI scaffold
- index.js – JavaScript code that implements the algorithms and hooks up UI events
- No other directories or config files, indicating a minimal static-hosting deployment.

##### Key Components
a. Static Web Server (or CDN) – serves index.html and index.js
b. Browser / Client
- UI Layer (HTML/CSS)
- Algorithm Module (JavaScript implementation of Quicksort & Binary Search)
c. User (human interacting via browser)

##### Component Relationships & Data Flow
- Static Server → Browser: Delivers index.html and index.js
- Browser (UI Layer) ←→ Algorithm Module:
- User enters or selects an array / target value in the UI
- UI Layer calls functions in index.js (quicksort, binarySearch)
- Algorithm Module processes data and returns sorted array or search result
- UI Layer updates the DOM to display results (sorted list / found‐not‐found status)

##### Architectural Patterns & Principles
- Separation of Concerns:
- Presentation (HTML/CSS in index.html)
- Application Logic (algorithm implementations in index.js)
- Single Responsibility: each function in index.js does exactly one thing (partitioning, recursion base-case, search step).

##### Technologies & Libraries
- Plain HTML5, CSS (if present), and vanilla JavaScript
- No frameworks or external dependencies—pure client-side code

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Components
    User["User"]:::user
    StaticServer["Static Web Server<br/>(serves index.html & index.js)"]:::server
    subgraph "Browser / Client"
        direction TB
        UILayer["UI Layer<br/>(HTML/CSS)"]:::ui
        AlgorithmModule["Algorithm Module<br/>(Quicksort & Binary Search)"]:::algo
    end

    %% Data Flows
    User -->|"user input: array, target value"| UILayer
    StaticServer -->|"HTTP GET index.html & index.js"| UILayer
    UILayer <-->|"invoke quicksort()/binarySearch() & returns result"| AlgorithmModule
    UILayer -->|"render sorted array or search outcome"| User

    %% Legend
    subgraph "Legend"
        direction TB
        A["Static Server"]:::server
        B["Browser / Client"]:::client
        C["UI Layer"]:::ui
        D["Algorithm Module"]:::algo
        E["User"]:::user
    end

    %% Click Events
    click StaticServer "https://github.com/sergiocalde/binarysearch-quicksortjs/tree/main//"
    click UILayer "https://github.com/sergiocalde/binarysearch-quicksortjs/blob/main/index.html"
    click AlgorithmModule "https://github.com/sergiocalde/binarysearch-quicksortjs/blob/main/index.js"

    %% Styles
    classDef server fill:#a3c4f3,stroke:#333,stroke-width:1px
    classDef client fill:#c2f0c2,stroke:#333,stroke-width:1px
    classDef ui fill:#fff2b2,stroke:#333,stroke-width:1px
    classDef algo fill:#fcd39b,stroke:#333,stroke-width:1px
    classDef user fill:#e0e0e0,stroke:#333,stroke-width:1px
```
