Implement the sorting algorithm you came up with in pseudocode with Python Test the sorting algorithm with a list of 10, 100, 1000 random numbers and compare the result using the %time to time your code and submit your results in code comments

Input: a list of integer values Operation: sort the list Output: a sorted list of values Note: Don't worry about checking data types, assume they'll always be integers but design for other error conditions


In [1]:
import random

In [2]:
list10 = []
for x in range(10):
    list10.append(random.randrange(100))

In [3]:
list100 = []
for x in range(100):
    list100.append(random.randrange(100))

In [4]:
list1000 = []
for x in range(1000):
    list1000.append(random.randrange(100))

In [10]:
def sort_list(old_list):
    def find_new_index(old_i):
        for new_i in range(1, len(new_list)):
            if new_list[new_i] > old_list[old_i]:
                return new_i

    new_list = [old_list[0]]
    for old_i in range(1, len(old_list)):
        if old_list[old_i] <= new_list[0]:
            new_list.insert(0, old_list[old_i])
        elif old_list[old_i] >= new_list[len(new_list)-1]:
            new_list.insert(len(new_list), old_list[old_i])
        else:
            new_list.insert(find_new_index(old_i), old_list[old_i])
    return new_list

In [6]:
%time sort_list(list10)


CPU times: user 29 µs, sys: 0 ns, total: 29 µs
Wall time: 34.1 µs
Out[6]:
[9, 31, 31, 40, 46, 51, 52, 55, 84, 91]

In [11]:
%time sort_list(list100)


CPU times: user 585 µs, sys: 1 µs, total: 586 µs
Wall time: 591 µs
Out[11]:
[2,
 2,
 3,
 4,
 7,
 7,
 9,
 10,
 11,
 11,
 13,
 14,
 15,
 16,
 17,
 18,
 19,
 20,
 22,
 25,
 26,
 27,
 29,
 32,
 35,
 36,
 37,
 39,
 41,
 43,
 44,
 44,
 44,
 45,
 47,
 47,
 49,
 49,
 49,
 53,
 53,
 53,
 54,
 54,
 55,
 57,
 57,
 57,
 61,
 62,
 63,
 64,
 65,
 66,
 66,
 67,
 67,
 67,
 68,
 69,
 71,
 71,
 72,
 73,
 74,
 74,
 74,
 75,
 76,
 79,
 79,
 79,
 80,
 80,
 80,
 81,
 81,
 81,
 82,
 82,
 83,
 86,
 86,
 88,
 88,
 89,
 89,
 90,
 90,
 90,
 91,
 91,
 91,
 93,
 96,
 96,
 97,
 98,
 99,
 99]

In [12]:
%time sort_list(list1000)


CPU times: user 33 ms, sys: 2.09 ms, total: 35.1 ms
Wall time: 34.6 ms
Out[12]:
[0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 1,
 1,
 1,
 1,
 1,
 1,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 4,
 4,
 4,
 4,
 4,
 4,
 4,
 4,
 4,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 7,
 7,
 7,
 7,
 7,
 7,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 9,
 9,
 9,
 9,
 9,
 9,
 9,
 9,
 10,
 10,
 10,
 10,
 10,
 10,
 10,
 10,
 11,
 11,
 11,
 11,
 11,
 11,
 11,
 11,
 11,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 13,
 13,
 13,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 16,
 16,
 16,
 16,
 16,
 16,
 16,
 16,
 16,
 17,
 17,
 17,
 17,
 17,
 17,
 18,
 18,
 18,
 18,
 18,
 18,
 18,
 18,
 19,
 19,
 19,
 19,
 19,
 19,
 19,
 19,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 22,
 22,
 22,
 22,
 22,
 22,
 23,
 23,
 23,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 25,
 25,
 25,
 25,
 25,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 27,
 27,
 27,
 27,
 27,
 27,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 30,
 30,
 30,
 30,
 30,
 30,
 30,
 31,
 31,
 31,
 31,
 31,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 34,
 34,
 34,
 34,
 34,
 34,
 34,
 34,
 35,
 35,
 35,
 35,
 35,
 35,
 35,
 35,
 36,
 36,
 36,
 36,
 36,
 36,
 36,
 36,
 36,
 37,
 37,
 37,
 37,
 37,
 37,
 37,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 39,
 39,
 39,
 39,
 39,
 39,
 39,
 39,
 39,
 40,
 40,
 40,
 40,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 45,
 45,
 45,
 45,
 45,
 45,
 45,
 45,
 45,
 46,
 46,
 46,
 46,
 46,
 46,
 46,
 46,
 47,
 47,
 47,
 47,
 47,
 47,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 54,
 54,
 54,
 54,
 54,
 54,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 59,
 59,
 59,
 59,
 60,
 60,
 60,
 60,
 60,
 60,
 61,
 61,
 61,
 61,
 61,
 61,
 61,
 61,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 65,
 65,
 65,
 65,
 65,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 69,
 69,
 69,
 69,
 69,
 69,
 69,
 69,
 70,
 70,
 70,
 70,
 70,
 70,
 70,
 71,
 71,
 71,
 71,
 71,
 71,
 71,
 71,
 71,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 80,
 80,
 80,
 80,
 80,
 80,
 80,
 80,
 80,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 82,
 82,
 82,
 82,
 82,
 82,
 82,
 82,
 82,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 84,
 84,
 84,
 84,
 84,
 84,
 84,
 84,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 87,
 87,
 87,
 87,
 87,
 87,
 87,
 88,
 88,
 88,
 88,
 88,
 89,
 89,
 89,
 89,
 89,
 89,
 89,
 89,
 89,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 93,
 93,
 93,
 93,
 93,
 93,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 95,
 95,
 95,
 95,
 95,
 95,
 95,
 95,
 95,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 98,
 98,
 98,
 98,
 98,
 98,
 98,
 98,
 99,
 99,
 99,
 99,
 99,
 99,
 99,
 99,
 99,
 99]

binary sorting


In [13]:
def bsort_list(old_list):
    new_list = [old_list[0]]
    
    def find_new_index(old_i):
        start_index = 0
        end_index = len(new_list) - 1
        while end_index - start_index > 1:
            middle_index = int((end_index - start_index) / 2 + start_index)
            if old_list[old_i] == new_list[start_index]: 
                new_i = start_index
                return new_i
            elif old_list[old_i] == new_list[end_index]: 
                new_i = end_index
                return new_i
            elif old_list[old_i] == new_list[middle_index]:
                new_i = middle_index
                return new_i
            elif old_list[old_i] < new_list[middle_index]:
                end_index = middle_index
            else:
                start_index = middle_index
        new_i = end_index
        return new_i
    
    for old_i in range(1, len(old_list)):
        if old_list[old_i] < new_list[0]:
            new_list.insert(0, old_list[old_i])
        elif old_list[old_i] > new_list[len(new_list) - 1]:
            new_list.insert(len(new_list), old_list[old_i])  
        else:
            new_list.insert(find_new_index(old_i), old_list[old_i])
    return new_list

In [14]:
print(list10)
print(bsort_list(list10))


[55, 9, 91, 52, 46, 84, 40, 31, 51, 31]
[9, 31, 31, 40, 46, 51, 52, 55, 84, 91]

In [15]:
%time bsort_list(list10)


CPU times: user 42 µs, sys: 0 ns, total: 42 µs
Wall time: 47 µs
Out[15]:
[9, 31, 31, 40, 46, 51, 52, 55, 84, 91]

sort_list(list10) was 29 µs, so this one is slower


In [16]:
%time bsort_list(list100)


CPU times: user 621 µs, sys: 2 µs, total: 623 µs
Wall time: 630 µs
Out[16]:
[2,
 2,
 3,
 4,
 7,
 7,
 9,
 10,
 11,
 11,
 13,
 14,
 15,
 16,
 17,
 18,
 19,
 20,
 22,
 25,
 26,
 27,
 29,
 32,
 35,
 36,
 37,
 39,
 41,
 43,
 44,
 44,
 44,
 45,
 47,
 47,
 49,
 49,
 49,
 53,
 53,
 53,
 54,
 54,
 55,
 57,
 57,
 57,
 61,
 62,
 63,
 64,
 65,
 66,
 66,
 67,
 67,
 67,
 68,
 69,
 71,
 71,
 72,
 73,
 74,
 74,
 74,
 75,
 76,
 79,
 79,
 79,
 80,
 80,
 80,
 81,
 81,
 81,
 82,
 82,
 83,
 86,
 86,
 88,
 88,
 89,
 89,
 90,
 90,
 90,
 91,
 91,
 91,
 93,
 96,
 96,
 97,
 98,
 99,
 99]

sort_list() was total: 586 µs, so this one is slower


In [17]:
%time bsort_list(list1000)


CPU times: user 6.77 ms, sys: 125 µs, total: 6.89 ms
Wall time: 6.82 ms
Out[17]:
[0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 0,
 1,
 1,
 1,
 1,
 1,
 1,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 2,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 3,
 4,
 4,
 4,
 4,
 4,
 4,
 4,
 4,
 4,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 5,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 6,
 7,
 7,
 7,
 7,
 7,
 7,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 8,
 9,
 9,
 9,
 9,
 9,
 9,
 9,
 9,
 10,
 10,
 10,
 10,
 10,
 10,
 10,
 10,
 11,
 11,
 11,
 11,
 11,
 11,
 11,
 11,
 11,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 12,
 13,
 13,
 13,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 14,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 15,
 16,
 16,
 16,
 16,
 16,
 16,
 16,
 16,
 16,
 17,
 17,
 17,
 17,
 17,
 17,
 18,
 18,
 18,
 18,
 18,
 18,
 18,
 18,
 19,
 19,
 19,
 19,
 19,
 19,
 19,
 19,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 20,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 21,
 22,
 22,
 22,
 22,
 22,
 22,
 23,
 23,
 23,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 24,
 25,
 25,
 25,
 25,
 25,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 26,
 27,
 27,
 27,
 27,
 27,
 27,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 28,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 29,
 30,
 30,
 30,
 30,
 30,
 30,
 30,
 31,
 31,
 31,
 31,
 31,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 32,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 33,
 34,
 34,
 34,
 34,
 34,
 34,
 34,
 34,
 35,
 35,
 35,
 35,
 35,
 35,
 35,
 35,
 36,
 36,
 36,
 36,
 36,
 36,
 36,
 36,
 36,
 37,
 37,
 37,
 37,
 37,
 37,
 37,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 38,
 39,
 39,
 39,
 39,
 39,
 39,
 39,
 39,
 39,
 40,
 40,
 40,
 40,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 41,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 42,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 43,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 44,
 45,
 45,
 45,
 45,
 45,
 45,
 45,
 45,
 45,
 46,
 46,
 46,
 46,
 46,
 46,
 46,
 46,
 47,
 47,
 47,
 47,
 47,
 47,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 48,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 49,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 50,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 51,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 52,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 53,
 54,
 54,
 54,
 54,
 54,
 54,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 55,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 56,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 57,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 58,
 59,
 59,
 59,
 59,
 60,
 60,
 60,
 60,
 60,
 60,
 61,
 61,
 61,
 61,
 61,
 61,
 61,
 61,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 62,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 63,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 64,
 65,
 65,
 65,
 65,
 65,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 66,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 67,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 68,
 69,
 69,
 69,
 69,
 69,
 69,
 69,
 69,
 70,
 70,
 70,
 70,
 70,
 70,
 70,
 71,
 71,
 71,
 71,
 71,
 71,
 71,
 71,
 71,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 72,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 73,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 74,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 75,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 76,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 77,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 78,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 79,
 80,
 80,
 80,
 80,
 80,
 80,
 80,
 80,
 80,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 81,
 82,
 82,
 82,
 82,
 82,
 82,
 82,
 82,
 82,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 83,
 84,
 84,
 84,
 84,
 84,
 84,
 84,
 84,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 85,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 86,
 87,
 87,
 87,
 87,
 87,
 87,
 87,
 88,
 88,
 88,
 88,
 88,
 89,
 89,
 89,
 89,
 89,
 89,
 89,
 89,
 89,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 90,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 91,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 92,
 93,
 93,
 93,
 93,
 93,
 93,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 94,
 95,
 95,
 95,
 95,
 95,
 95,
 95,
 95,
 95,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 96,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 97,
 98,
 98,
 98,
 98,
 98,
 98,
 98,
 98,
 99,
 99,
 99,
 99,
 99,
 99,
 99,
 99,
 99,
 99]

sort_list(list1000) was total: 35.1 ms, so THIS ONE IS FINALLY FASTER!