divide and conquer algorithm python