Skip to main content
100%

Merge Sort

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Sep 26, 2011

Two hundred forty line segments, each encoding an array value by rotation angle, animate through seven passes of bottom-up merge sort. Randomly shuffled values are rendered as SVG lines, with each pass showing sorted sub-arrays as groupings of parallel bars. The animation uses `d3.shuffle`, `d3.scale.linear`, and `transition.attr` to smoothly rotate lines into new positions. The design resembles wind gusting over grass, making sorted runs visually distinct.

AI-generated description

This animation is based on elegant visualizations by Robert Sedgewick, published in Algorithms in C (1998). Seven sequential passes of a bottom-up merge sort algorithm are shown, with array values encoded using angle. The design, reminiscent of wind gusting over tall grasses, allows rapid perception of sorted sub-arrays. Based on an earlier Protovis example.

See also quick sort.

gpl-3.0 Licensed

Similar vizzes