Skip to main content
100%

Mergesort II

✓ Published0🌍 Public
BBeaupe
Last edited Nov 7, 2015
Created on Nov 7, 2015

This animation visualizes the mergesort algorithm sorting 200 shuffled values. The two subarrays currently being merged are displayed in black, while inactive lines are gray. Each line represents a value, with its vertical position indicating which temporary array it occupies and its rotation encoding the value. The code implements the sorting logic and action queue in JavaScript, then uses d3.v3 transitions with 75ms duration to animate each copy and swap operation as SVG line elements.

AI-generated description

An improved animation of mergesort. As the name suggests, the algorithm merges sorted arrays, starting with arrays of length 1 and doubling at each step. The two subarrays currently being merged are shown in black.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/6928381c7b61714da59e'>Mergesort II</a>

Similar vizzes