Skip to content

Add Sorting Visualizer component and sorting steps logic; integrate into App#218

Open
tomadowley wants to merge 1 commit intomasterfrom
cosine/feat/cool-feature
Open

Add Sorting Visualizer component and sorting steps logic; integrate into App#218
tomadowley wants to merge 1 commit intomasterfrom
cosine/feat/cool-feature

Conversation

@tomadowley
Copy link
Owner

  • Introduces a new Sorting Visualizer UI component that visualizes sorting algorithms in real-time. It renders alongside the existing Prime Checker in App.tsx.
  • Adds sorting step generation utilities in src/sortSteps.ts:
    • Defines AlgoName ('bubble' | 'selection' | 'insertion') and Frame (array snapshot).
    • Implements bubbleSortSteps, selectionSortSteps, insertionSortSteps, and getSteps to produce frames for each algorithm.
  • New UI in src/components/SortingVisualizer.tsx:
    • Allows choosing algorithm, array size, and animation speed.
    • Provides Generate, Play/Pause, Step, and Reset controls.
    • Visualizes frames as a bar chart with responsive layout and gradients.
  • How it works:
    • Generates a random array of the selected size, computes the frames using getSteps, and animates through frames when Play is active.
    • Bars component renders the current frame, scaling heights based on max value.
  • This feature adds a playful, educational visualization to the repo and demonstrates integration of new components with existing UI.

This pull request was co-created with Cosine Genie

Original Task: sorbox/y4kw6mgkrg6r
Author: Tom Dowley

Co-authored-by: Genie <genie@cosine.sh>
@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sorbox Ready Ready Preview Comment Dec 4, 2025 4:29pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant