-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Labels
Description
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