divide and conquer algorithm in c