You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine that you are holding some sorted cards in your hand. You get a new card from the table. You have to insert it in the correct place in your hand. "Take a new card, insert in the right place. Take another new card, insert it in the right place". This is the main idea of the insertion sort.
Write an insertionSort function that takes an array and returns it as sorted by using the isOrderedBefore closure. Don't mutate the original array (don't use inout).
There is already a swap function in the standard library. However, you can just move the larger elements to the right rather than using the swap function.
Due Date: Monday 30.11.2015
The text was updated successfully, but these errors were encountered:
Imagine that you are holding some sorted cards in your hand. You get a new card from the table. You have to insert it in the correct place in your hand. "Take a new card, insert in the right place. Take another new card, insert it in the right place". This is the main idea of the insertion sort.
Write an
insertionSort
function that takes an array and returns it as sorted by using theisOrderedBefore
closure. Don't mutate the original array (don't use inout).There is already a
swap
function in the standard library. However, you can just move the larger elements to the right rather than using theswap
function.Due Date: Monday 30.11.2015
The text was updated successfully, but these errors were encountered: