|
|
|
|
|
by leereeves
1453 days ago
|
|
Quite right, that was a silly mistake on my part. I did say the smallest element was placed first, but wrote "the list is ultimately sorted in decreasing, not increasing order" backwards. I meant to contradict the top post: "the largest number is at position 1...we can treat n+1 as a new array of length N-n and solve using the base case proof", which would result in decreasing order (largest first). |
|
Beyond that it's just inserting the ith element into the list by finding its place and shifting everything over one position.