Objective
Sort a in place by insertion and hand the whole array to report after every insertion, so the caller can watch the sorted prefix grow one slot at a time.
Steps
$ insertion_steps(a, 4, report) with a = {4, 3, 2, 1}
step: 3 4 2 1 step: 2 3 4 1 step: 1 2 3 4 calls: 3
$ insertion_steps(a, 4, report) with a = {1, 2, 3, 4}
step: 1 2 3 4 step: 1 2 3 4 step: 1 2 3 4 calls: 3
$ insertion_steps(a, 1, report) with a = {42}, then the buffer
calls: 0 arr: 42
$ insertion_steps(a, 3, report) with a = {3, 1, 2, 99}, then the buffer
step: 1 3 2 step: 1 2 3 calls: 2 arr: 1 2 3 99
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Objective
Sort a in place by insertion and hand the whole array to report after every insertion, so the caller can watch the sorted prefix grow one slot at a time.
Steps
$ insertion_steps(a, 4, report) with a = {4, 3, 2, 1}
step: 3 4 2 1 step: 2 3 4 1 step: 1 2 3 4 calls: 3
$ insertion_steps(a, 4, report) with a = {1, 2, 3, 4}
step: 1 2 3 4 step: 1 2 3 4 step: 1 2 3 4 calls: 3
$ insertion_steps(a, 1, report) with a = {42}, then the buffer
calls: 0 arr: 42
$ insertion_steps(a, 3, report) with a = {3, 1, 2, 99}, then the buffer
step: 1 3 2 step: 1 2 3 calls: 2 arr: 1 2 3 99
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Tests
Run the tests to grade your code