Mergesort w/ color
A random array of 100 values is sorted by the mergesort algorithm, with each value drawn as a colored vertical line whose color transitions from light green to dark green based on its numeric value. The animation shows the sorting process as lines move between two horizontal bands representing the two arrays being merged, with copies and swaps visualized through D3 transitions. The code uses d3.shuffle, d3.scale.ordinal for positioning, and d3.scale.linear for the color ramp, rendering in SVG with animated transitions.
AI-generated descriptionAn adaptation of <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/39566aca95eb03ddd526'>Mergesort I</a>, modified to include color. The sorting is admittedly not as clear at first.