@@ -0,0 +1,1841 @@
+#!/usr/bin/env python3%0A%0A%0Adef merge_sorted_list(alist, blist):%0A    %22%22%22 Use merge sort to sort sorted alist and blist, and return merged sorted list of alist. %22%22%22%0A%0A    if not isinstance(alist, list):%0A        raise TypeError(%22%7B%7D should be of type list%22.format(alist))%0A%0A    if not isinstance(blist, list):%0A        raise TypeError(%22%7B%7D should be of type list%22.format(blist))%0A%0A    sorted_list = %5B%5D%0A%0A    alist_length = len(alist)%0A    blist_length = len(blist)%0A%0A    i = 0%0A    j = 0%0A    while (i %3C alist_length) or (j %3C blist_length):%0A%0A        if i == alist_length:%0A            sorted_list.append(blist%5Bj%5D)%0A            j = j + 1%0A        elif j == blist_length:%0A            sorted_list.append(alist%5Bi%5D)%0A            i = i + 1%0A        elif alist%5Bi%5D %3C= blist%5Bj%5D:%0A            sorted_list.append(alist%5Bi%5D)%0A            i = i + 1%0A        else:%0A            sorted_list.append(blist%5Bj%5D)%0A            j = j + 1%0A%0A    return sorted_list%0A%0A%0Adef merge_sort_list(alist):%0A    %22%22%22 Use merge sort to sort alist and return sorted list of alist. %22%22%22%0A%0A    if not isinstance(alist, list):%0A        raise TypeError(%22%7B%7D should be of type list%22.format(alist))%0A%0A    length = len(alist)%0A%0A    if length == 2:%0A        if alist%5B0%5D %3E alist%5B1%5D:%0A            tmp = alist%5B0%5D%0A            alist%5B0%5D = alist%5B1%5D%0A            alist%5B1%5D = tmp%0A%0A        return alist%0A%0A    elif length == 1:%0A        return alist%0A%0A    half_length = int(length / 2)%0A    first_half_list = alist%5B:half_length%5D%0A    second_half_list = alist%5Bhalf_length:%5D%0A%0A    sorted_list = merge_sorted_list(merge_sort_list(first_half_list), merge_sort_list(second_half_list))%0A    return sorted_list%0A%0A%0Aif __name__ == %22__main__%22:%0A    source_list = %5B3, 2, 1, 5, 6, 10, 9, 8, 4, 7, 0%5D%0A    print(%22source list before sort = %7B%7D%22.format(source_list))%0A    sorted_list = merge_sort_list(source_list)%0A    print(%22sorted_list = %7B%7D%22.format(sorted_list))%0A

Add merge sort practice of python int list.