from __future__ import absolute_import
from __future__ import print_function
from __future__ import division

def find_min_max_naive(a_ls):
    """Find mix & max in a list by naive method."""
    _min = a_ls[0]
    _max = a_ls[0]
    for i in range(1, len(a_ls)):
        _min = min(_min, a_ls[i])
        _max = max(_max, a_ls[i])
    return [_min, _max]


def main():
    # a_ls = [1, 2, 3, 4, 5, 6, 7, 8]
    a_ls = [1, 2, 3, 4, 5, 6, 7, 8, 9]
    print('A list: {}'.format(a_ls))
    print('Find min & max:')

    print('By naive method: {}'
          .format(find_min_max_naive(a_ls)))

if __name__ == '__main__':
    main()

@@ -351,16 +351,503 @@
 _max%5D%0A%0A%0A
+def find_min_max_dc(a_ls):%0A    %22%22%22Find mix & max in a list by divide and conquer method.%22%22%22%0A    if len(a_ls) == 1:%0A        return %5Ba_ls%5B0%5D, a_ls%5B0%5D%5D%0A    elif 1 %3C len(a_ls) %3C 3:%0A        if a_ls%5B0%5D %3C a_ls%5B1%5D:%0A            return %5Ba_ls%5B0%5D, a_ls%5B1%5D%5D%0A        else:%0A            return %5Ba_ls%5B1%5D, a_ls%5B0%5D%5D%0A    else:%0A        %5B_min1, _max1%5D = find_min_max_dc(a_ls%5B:len(a_ls)//2%5D)%0A        %5B_min2, _max2%5D = find_min_max_dc(a_ls%5Blen(a_ls)//2:%5D)%0A        return %5Bmin(_min1, _min2), max(_max1, _max2)%5D%0A%0A%0A
 def main
@@ -1072,16 +1072,104 @@
 _ls)))%0A%0A
+    print('By divide and conquer method: %7B%7D'%0A          .format(find_min_max_dc(a_ls)))%0A%0A
 if __nam

Complete find_min_max_dc() with divide and conquer method