divide and conquer method