Swift, Sorting and Binary Search Algorithm

Useful Foundation APIs swapAt Bubble Sort Every steps compares 2 values and swapped it Red = Sorted Item Time complexity is O(n^2) Space complexity is O(1) Insertion Sort Apple Foundation uses TimSort (InsertionSort + MergeSort) Insertion Sort is another O(N^2) quadratic running time algorithm On large datasets it is very inefficient – but on arrays … Continue reading Swift, Sorting and Binary Search Algorithm