Intuition
Problem wants us to solve without using any library sorting functions such as arr.sort()
in Python or Arrays.sort(arr)
in Java.
So let’s implement a Merge Sort - since it fits the description of a n * log (n)
algorithm. Remember, bubble sort, insertion sort take quadratic time, we need something faster.
Please refer my breaking down and analysis of how Merge Sort works.
Code
Python3
Big O Analysis
-
Runtime
The runtime complexity here is since we are using Merge Sort.
-
Memory
The memory usage is since we are using Merge Sort :)
— A