python program divide and conquer algorithm