How gautam23145032/sortingvisualizer works
File structure
• Top-level files only:
• index.html – the shell/UI container
• style.css – all layout and styling (Flexbox, responsive tweaks)
• script.js – the entire sorting logic, event handlers, and animation routines
• No backend, no build tools, no dependencies.
README for additional insights
• Confirms it’s purely HTML/CSS/JS.
• Features include play/pause controls, algorithm benchmarking, adjustable array size/speed, real-time timing metrics.
• Technologies: HTML5, CSS3, JavaScript (ES6+).
a. Main components to represent:
• Browser (Client Runtime)
• UI Layer (HTML + CSS)
• Sorting Engine (JavaScript module in script.js)
• Control Panel & User Input (buttons, sliders)
• Rendering Engine (DOM update & animation loop)
• Metrics Collector (timing & comparisons counter)
b. Relationships & interactions:
1. User interacts with Control Panel → events fired to Sorting Engine
2. Sorting Engine manipulates the in-memory array model
3. Sorting Engine emits update events → Rendering Engine updates the DOM bars
4. Metrics Collector hooks into Sorting Engine to compute time/operations → updates UI
c. Architectural patterns / design principles:
• MVC-like separation:
• Model: the in-memory array & metrics state
• View: DOM elements styled by CSS
• Controller: event handlers in script.js that orchestrate sorting calls and animations
• Single responsibility: each function in script.js handles one sorting algorithm or one UI update
• Event-driven: using requestAnimationFrame or setTimeout for smooth step-by-step animations
d. Key technologies/frameworks:
• HTML5 (semantic structure for chart & controls)
• CSS3 Flexbox (responsive layout)