Skip to main content
100%

Improving array to tree

✓ Published0🌍 Public
MMTR
Last edited Mar 24, 2021
Created on Mar 24, 2021
Forked from array to tree

A shuffled array of ten numbers becomes a binary tree, with each node displaying its value. D3's `d3.stratify` converts the flat array into hierarchical data, and `d3.tree` computes the layout. The SVG renders nodes as red-bordered circles connected by black paths. A transition animates the text labels, with a duration that increases based on node depth. The example shows repeated re-shuffling and re-rendering of the tree with each of the ten random permutations.

AI-generated description

Converts an Array into tree.

MIT Licensed

Similar vizzes