Build a sorted array one element at a time. Pick each element and insert it into the correct position among the already-sorted elements, shifting others right to make room.
time:O(n²)
space:O(1)
⚡ +100_XP
step[1/21]
> Start
64
25
12
22
11
90
▸Insertion Sort: build a sorted portion one element at a time, inserting each into its correct place.
// tap NEXT STEP to walk through one step at a time