39
Key Questions:
●Why does the outer loop start at 1?
i. Indices [1,n-1] represent the elements that need to be inserted in the
previous portion of the list. The element at 0 is implicitly sorted via
swaps.
●Why use a while loop for the internal loop rather than a for loop like
Selection Sort?
i. Indefinite number of swaps
ii. For loop can also work with correct condition/setup.
●Stable or Unstable?
i. Stable -> an element that started later in the array is never inserted
before a previous one that is equivalent to it. (arr[j] > key in while loop
Sorting