divide and conquer algorithm code example