🌍 Public
Viewing a saved revision (read-only)
c602016fc1884e509fc8fd7e21deb878
Improving 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 descriptionConverts an Array into tree.