<commit_before>"""
@author: <NAME>
@email: <EMAIL>
@date: 22/6/17

Insertion Sort -> O(n^2)
"""
from random import randint
from timeit import Timer, default_timer


def insertion_sort(data):
    for i in range(1, len(data)):
        key = data[i]
        j = i - 1
        while j >= 0 and data[j] > key:
            data[j+1] = data[j]
            j = j - 1
        data[j+1] = key


def main():
    start = default_timer()
    data = [randint(1, 10) + i for i in range(100001)]
    insertion_sort(data)
    print("Sort Time = %f Seconds" % (default_timer() - start))


if __name__ == '__main__':
    print("Insertion Sort")<commit_msg>Update InsertionSort.py<commit_after>"""
@author: <NAME>
@email: <EMAIL>
@date: 22/6/17

Worst Case Analysis: Insertion Sort -> O(n^2)
"""
from timeit import Timer, default_timer


def insertion_sort(data):
    for i in range(1, len(data)):
        key = data[i]
        j = i - 1
        while j >= 0 and data[j] > key:
            data[j+1] = data[j]
            j = j - 1
        data[j+1] = key


def main():
    start = default_timer()
    data = [i for i in range(10000, 0, -1)]    # Worst Case Input(Reverse Sorted)
    insertion_sort(data)
    print("Sort Time = %f Seconds" % (default_timer() - start))


if __name__ == '__main__':
    print("Insertion Sort")
{'fraction_non_alphanumeric': 0.15172413793103448, 'fraction_numerical': 0.03065134099616858, 'mean_word_length': 2.568306010928962, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2203338', 'n_tokens_mistral': 506, 'n_tokens_neox': 471, 'n_words': 139}