Types of sorting
Insertion sort
- We use it in our daily lives and is very practical and easy to implement. However, the insertion sort is somewhat inaccurate first try.
- Sorting by comparison, and insertion of elements, based on adjacent elements. However, multiple passes are necessary to make sure the whole the list is sorted. Time complexity:
- worst case scenario O(N^2)
- best case scenario O(1)
9/10 Great Career Potential
Quicksort
- Sorting by “pivot”. The pivot finds its position along the line, this splits the array into two. Then quicksort is called recursively and the resulting subarrays are also sorted by quicksort. Time complexity:
- O(NlogN)
9/10 very good use of music throughout
Bubble sort
- Swap adjacent elements only, so very slow and not practical
- bad time complexity of O(N) best and O(N^2) worst. requires a few passes
10/10 effective usage of pair programming and well-explained and creative. pick-up lines were on-point
Merge sort
- Time complexity O(NlogN)
- Split arrays into groups of 2. Then sort each group, then combine sort each time multiplying size by 2 (4, 8, 16, …)
9/10 Great sorting, though complicated sort and somewhat muddled in the group sort
Selection sort
- Move through the list, and select the smallest value to swap with the front.
- O(N^2) always
10/10 Great murder mystery and acting