# nishanth-1830/algorithm-explorer architecture

> Architecture diagram of the GitHub repository nishanth-1830/algorithm-explorer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nishanth-1830/algorithm-explorer
- Repository: https://github.com/nishanth-1830/algorithm-explorer

## Overview

Cargo Optima is a browser-based 0/1 knapsack optimizer and algorithm comparison tool. Users enter or load cargo items and a capacity, then compare brute-force, backtracking, greedy, and dynamic-programming solutions with packed-item summaries, execution metrics, traces, and algorithm-specific detail views. The excerpts show the UI setup and each solver, but omit the event-handler section that would confirm how the app dispatches to the solvers; those links are therefore marked unverified.

Main entry points: [`app.js`](https://github.com/nishanth-1830/algorithm-explorer/blob/main/app.js) (Knapsack Workbench), [`algorithms/bruteForce.js`](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/bruteForce.js) (Brute Force), [`algorithms/backtracking.js`](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/backtracking.js) (Backtracking), [`algorithms/greedy.js`](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/greedy.js) (Greedy Heuristic)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User Interface"]
  node_workbench["Knapsack Workbench<br/>[app.js]"]
end

subgraph group_solvers["Knapsack Solvers"]
  node_brute["Brute Force<br/>[bruteForce.js]"]
  node_backtracking["Backtracking<br/>[backtracking.js]"]
  node_greedy["Greedy Heuristic<br/>[greedy.js]"]
  node_dynamic["Dynamic Programming"]
end

subgraph group_results["Results and Comparison"]
  node_comparison["Comparison and Details<br/>[app.js]"]
end

node_user(("User"))

node_user -->|"enters items"| node_workbench
node_workbench -.->|"dispatches to"| node_brute
node_workbench -.->|"dispatches to"| node_backtracking
node_workbench -.->|"dispatches to"| node_greedy
node_workbench -.->|"dispatches to"| node_dynamic
node_workbench -->|"renders results"| node_comparison
node_brute -.->|"returns solution"| node_comparison
node_backtracking -.->|"returns solution"| node_comparison
node_greedy -.->|"returns solution"| node_comparison
node_dynamic -.->|"returns solution"| node_comparison

click node_workbench "https://github.com/nishanth-1830/algorithm-explorer/blob/main/app.js"
click node_brute "https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/bruteForce.js"
click node_backtracking "https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/backtracking.js"
click node_greedy "https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/greedy.js"
click node_dynamic "https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/dynamicProgramming.js"
click node_comparison "https://github.com/nishanth-1830/algorithm-explorer/blob/main/app.js"

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_workbench,node_user toneBlue
class node_brute,node_backtracking,node_greedy,node_dynamic toneAmber
class node_comparison toneMint
```

## Components

### User Interface

- [Knapsack Workbench](https://github.com/nishanth-1830/algorithm-explorer/blob/main/app.js): `app.js`

### Knapsack Solvers

- [Brute Force](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/bruteForce.js): `algorithms/bruteForce.js`
- [Backtracking](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/backtracking.js): `algorithms/backtracking.js`
- [Greedy Heuristic](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/greedy.js): `algorithms/greedy.js`
- [Dynamic Programming](https://github.com/nishanth-1830/algorithm-explorer/blob/main/algorithms/dynamicProgramming.js): `algorithms/dynamicProgramming.js`

### Results and Comparison

- [Comparison and Details](https://github.com/nishanth-1830/algorithm-explorer/blob/main/app.js): `app.js`

### Other components

- **User**

## Connections

- User → Knapsack Workbench: enters items (evidence: `app.js`)
- Knapsack Workbench → Brute Force: dispatches to
- Knapsack Workbench → Backtracking: dispatches to
- Knapsack Workbench → Greedy Heuristic: dispatches to
- Knapsack Workbench → Dynamic Programming: dispatches to
- Knapsack Workbench → Comparison and Details: renders results (evidence: `app.js`)
- Brute Force → Comparison and Details: returns solution
- Backtracking → Comparison and Details: returns solution
- Greedy Heuristic → Comparison and Details: returns solution
- Dynamic Programming → Comparison and Details: returns solution
