Hardware interview practice
Insertion sort in place
Sort a dynamic array of integers in ascending order using insertion sort.
Reviewed example
Work through one case
Input
values = [5, 1, 4, 2]Expected output
[1, 2, 4, 5]Each element is inserted into the already sorted prefix while equal elements retain their order.
What to cover
Requirements
- Modify the input array in place.
- Keep equal values in their original relative order.
- Handle negative values and duplicate values.
