Solved LeetCode program · 146 of 1,000
#0147 · Insertion Sort List
Original English source
Keep a shared values holding 4, 2, 1, and 3.
To shift from spot (a whole number) with key (a whole number). If spot is less than 0, set item 0 of values to key, return. If item spot of values is at most key, set item (spot plus 1) of values to key, return. Set item (spot plus 1) of values to item spot of values. Shift from spot minus 1 with key.
The last is 3.
For every spot from 1 to last.
The key is item spot of values. Shift from spot minus 1 with key.
For each value in values, show value.
Expected stdout
1 2 3 4