1# The algorithm used by Python's sort() and sorted() is known as Timsort.
2# This algorithm is based on Insertion sort and Merge sort.
3# A stable sorting algorithm works in O(n Log n) time.
4# Used in Java’s Arrays.sort() as well.
5
6# The array is divided into blocks called Runs.
7# These Runs are sorted using Insertion sort and then merged using Merge sort.
8
9arr = [6, 2, 8, 9, 5, 3, 0, 15]
10arr.sort() # Since sort() does inplace sorting and returns None
11print(arr)
12
13arr = [6, 2, 8, 9, 5, 3, 0, 15]
14print(sorted(arr)) # sorted() returns the sorted array