{
  "slug": "heap-sort",
  "title": "Heap Sort",
  "category": "Sorting",
  "difficulty": "hard",
  "complexity": {
    "time": "O(n log n)",
    "space": "O(1)"
  },
  "idea": "Treat the array as a binary heap (children of i live at 2i+1 and 2i+2). Build a max-heap so the biggest value is at the front, swap it to the end, shrink the heap, and sift the new root down. Repeat.",
  "code": [
    "build: for i = n/2-1 down to 0: siftDown(i, n)",
    "for end = n-1 down to 1:",
    "    swap(0, end)              # max to the end",
    "    siftDown(0, end)          # restore the heap",
    "siftDown(i, size): sink a[i] past its larger child"
  ],
  "example": {
    "array": [
      4,
      10,
      3,
      5,
      1,
      8,
      2,
      7
    ]
  },
  "invariant": "Each step is the real data structure at that step — the picture is a pure function of it.",
  "stepCount": 37,
  "steps": [
    {
      "i": 0,
      "op": "say",
      "caption": "Heap sort: first arrange the array into a max-heap.",
      "note": null,
      "codeLine": 1,
      "stats": null,
      "array": [
        4,
        10,
        3,
        5,
        1,
        8,
        2,
        7
      ],
      "focus": [
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [],
      "regions": []
    },
    {
      "i": 1,
      "op": "compare",
      "caption": "Parent 5 vs larger child 7.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        10,
        3,
        5,
        1,
        8,
        2,
        7
      ],
      "focus": [
        null,
        null,
        null,
        "compare",
        null,
        null,
        null,
        "compare"
      ],
      "markers": [
        {
          "name": "node",
          "index": 3,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 2,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        10,
        3,
        7,
        1,
        8,
        2,
        5
      ],
      "focus": [
        null,
        null,
        null,
        "swap",
        null,
        null,
        null,
        "swap"
      ],
      "markers": [
        {
          "name": "node",
          "index": 3,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 3,
      "op": "compare",
      "caption": "Parent 3 vs larger child 8.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        10,
        3,
        7,
        1,
        8,
        2,
        5
      ],
      "focus": [
        null,
        null,
        "compare",
        null,
        null,
        "compare",
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 2,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 4,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        10,
        8,
        7,
        1,
        3,
        2,
        5
      ],
      "focus": [
        null,
        null,
        "swap",
        null,
        null,
        "swap",
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 2,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 5,
      "op": "compare",
      "caption": "Parent 10 vs larger child 7.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        10,
        8,
        7,
        1,
        3,
        2,
        5
      ],
      "focus": [
        null,
        "compare",
        null,
        "compare",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 6,
      "op": "compare",
      "caption": "Parent 4 vs larger child 10.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        10,
        8,
        7,
        1,
        3,
        2,
        5
      ],
      "focus": [
        "compare",
        "compare",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 7,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        10,
        4,
        8,
        7,
        1,
        3,
        2,
        5
      ],
      "focus": [
        "swap",
        "swap",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 8,
      "op": "compare",
      "caption": "Parent 4 vs larger child 7.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        10,
        4,
        8,
        7,
        1,
        3,
        2,
        5
      ],
      "focus": [
        null,
        "compare",
        null,
        "compare",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 9,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        10,
        7,
        8,
        4,
        1,
        3,
        2,
        5
      ],
      "focus": [
        null,
        "swap",
        null,
        "swap",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 10,
      "op": "compare",
      "caption": "Parent 4 vs larger child 5.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        10,
        7,
        8,
        4,
        1,
        3,
        2,
        5
      ],
      "focus": [
        null,
        null,
        null,
        "compare",
        null,
        null,
        null,
        "compare"
      ],
      "markers": [
        {
          "name": "node",
          "index": 3,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 11,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        10,
        7,
        8,
        5,
        1,
        3,
        2,
        4
      ],
      "focus": [
        null,
        null,
        null,
        "swap",
        null,
        null,
        null,
        "swap"
      ],
      "markers": [
        {
          "name": "node",
          "index": 3,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 12,
      "op": "say",
      "caption": "Max-heap ready — the largest value sits at the front.",
      "note": null,
      "codeLine": 2,
      "stats": null,
      "array": [
        10,
        7,
        8,
        5,
        1,
        3,
        2,
        4
      ],
      "focus": [
        null,
        null,
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 13,
      "op": "swap",
      "caption": "Move the max 10 to index 7.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        4,
        7,
        8,
        5,
        1,
        3,
        2,
        10
      ],
      "focus": [
        "swap",
        null,
        null,
        null,
        null,
        null,
        null,
        "swap"
      ],
      "markers": [],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 7,
          "tone": "window"
        }
      ]
    },
    {
      "i": 14,
      "op": "compare",
      "caption": "Parent 4 vs larger child 8.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        7,
        8,
        5,
        1,
        3,
        2,
        10
      ],
      "focus": [
        "compare",
        null,
        "compare",
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 6,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 7,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 15,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        8,
        7,
        4,
        5,
        1,
        3,
        2,
        10
      ],
      "focus": [
        "swap",
        null,
        "swap",
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 6,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 7,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 16,
      "op": "compare",
      "caption": "Parent 4 vs larger child 3.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        8,
        7,
        4,
        5,
        1,
        3,
        2,
        10
      ],
      "focus": [
        null,
        null,
        "compare",
        null,
        null,
        "compare",
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 2,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 6,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 7,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 17,
      "op": "swap",
      "caption": "Move the max 8 to index 6.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        2,
        7,
        4,
        5,
        1,
        3,
        8,
        10
      ],
      "focus": [
        "swap",
        null,
        null,
        null,
        null,
        null,
        "swap",
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 2,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 6,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 7,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 18,
      "op": "compare",
      "caption": "Parent 2 vs larger child 7.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        2,
        7,
        4,
        5,
        1,
        3,
        8,
        10
      ],
      "focus": [
        "compare",
        "compare",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 5,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 6,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 19,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        7,
        2,
        4,
        5,
        1,
        3,
        8,
        10
      ],
      "focus": [
        "swap",
        "swap",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 5,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 6,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 20,
      "op": "compare",
      "caption": "Parent 2 vs larger child 5.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        7,
        2,
        4,
        5,
        1,
        3,
        8,
        10
      ],
      "focus": [
        null,
        "compare",
        null,
        "compare",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 5,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 6,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 21,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        7,
        5,
        4,
        2,
        1,
        3,
        8,
        10
      ],
      "focus": [
        null,
        "swap",
        null,
        "swap",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 5,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 6,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 22,
      "op": "swap",
      "caption": "Move the max 7 to index 5.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        3,
        5,
        4,
        2,
        1,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        null,
        null,
        null,
        null,
        "swap",
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 5,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 6,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 23,
      "op": "compare",
      "caption": "Parent 3 vs larger child 5.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        3,
        5,
        4,
        2,
        1,
        7,
        8,
        10
      ],
      "focus": [
        "compare",
        "compare",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 4,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 5,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 24,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        5,
        3,
        4,
        2,
        1,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        "swap",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 4,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 5,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 25,
      "op": "compare",
      "caption": "Parent 3 vs larger child 2.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        5,
        3,
        4,
        2,
        1,
        7,
        8,
        10
      ],
      "focus": [
        null,
        "compare",
        null,
        "compare",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 4,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 5,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 26,
      "op": "swap",
      "caption": "Move the max 5 to index 4.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        1,
        3,
        4,
        2,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        null,
        null,
        null,
        "swap",
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 1,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 4,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 5,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 27,
      "op": "compare",
      "caption": "Parent 1 vs larger child 4.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        1,
        3,
        4,
        2,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "compare",
        null,
        "compare",
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 3,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 4,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 28,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        4,
        3,
        1,
        2,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        null,
        "swap",
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 3,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 4,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 29,
      "op": "swap",
      "caption": "Move the max 4 to index 3.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        2,
        3,
        1,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        null,
        null,
        "swap",
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 3,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 4,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 30,
      "op": "compare",
      "caption": "Parent 2 vs larger child 3.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        2,
        3,
        1,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "compare",
        "compare",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 2,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 3,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 31,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        3,
        2,
        1,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        "swap",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 2,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 3,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 32,
      "op": "swap",
      "caption": "Move the max 3 to index 2.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        1,
        2,
        3,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        null,
        "swap",
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 2,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 3,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 33,
      "op": "compare",
      "caption": "Parent 1 vs larger child 2.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        1,
        2,
        3,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "compare",
        "compare",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 1,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 2,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 34,
      "op": "swap",
      "caption": "Parent is smaller — sink it down.",
      "note": null,
      "codeLine": 5,
      "stats": null,
      "array": [
        2,
        1,
        3,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        "swap",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 1,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 2,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 35,
      "op": "swap",
      "caption": "Move the max 2 to index 1.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        1,
        2,
        3,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "swap",
        "swap",
        null,
        null,
        null,
        null,
        null,
        null
      ],
      "markers": [
        {
          "name": "node",
          "index": 0,
          "tone": "pivot"
        }
      ],
      "regions": [
        {
          "label": "heap",
          "from": 0,
          "to": 1,
          "tone": "window"
        },
        {
          "label": "sorted",
          "from": 2,
          "to": 7,
          "tone": "settled"
        }
      ]
    },
    {
      "i": 36,
      "op": "settle",
      "caption": "Sorted.",
      "note": null,
      "codeLine": 3,
      "stats": null,
      "array": [
        1,
        2,
        3,
        4,
        5,
        7,
        8,
        10
      ],
      "focus": [
        "settled",
        "settled",
        "settled",
        "settled",
        "settled",
        "settled",
        "settled",
        "settled"
      ],
      "markers": [],
      "regions": [
        {
          "label": "sorted",
          "from": 0,
          "to": 7,
          "tone": "settled"
        }
      ]
    }
  ]
}