Skip to content

Latest commit

 

History

History
25 lines (19 loc) · 1.07 KB

File metadata and controls

25 lines (19 loc) · 1.07 KB

Real-time visualization of sorting

Create a single self-contained index.html file with a real-time sorting algorithm visualizer. Requirements:

Algorithms to include: Bubble Sort, Insertion Sort, Selection Sort, Merge Sort, Quick Sort, and Heap Sort.

Visuals:

  • Display the array as animated vertical bars with color coding: default color for unsorted, a highlight color for elements being compared, and a distinct color for sorted elements
  • Smooth animations between each step
  • Dark background, vibrant colors

Controls:

  • Buttons to select the algorithm
  • A slider to control animation speed (from very slow to very fast)
  • A slider to control array size (from 10 to 200 elements)
  • A "Shuffle & Reset" button that generates a new random array
  • A "Start / Pause" toggle button

Stats panel (live-updating during sort):

  • Algorithm name
  • Number of comparisons
  • Number of swaps
  • Time elapsed

Make the UI look modern and polished. All in one HTML file, no external dependencies except a CDN is allowed if needed. The code must run correctly in a browser by simply opening the file.