Skip to main content
100%

Quicksort CodingTrain sketch

✓ Published0🌍 Public
WWikunia
Last edited Apr 4, 2019
Created on Apr 4, 2019

This visualization demonstrates the quicksort algorithm by animating the partitioning and recursive sorting of an array of vertical bars. Each bar’s height represents a random value, while color encodes state: white for unsorted, green for the current subarray, and red for the pivot. The p5.js `draw` loop renders the bars and draws orange comparison lines between active elements. The code uses p5.js `createCanvas`, `rect`, and `line`, plus JavaScript `async`/`await` with `setTimeout`-based `sleep` to pace swaps, with `Promise.all` coordinating recursive calls.

AI-generated description

Similar vizzes