add the divide and conquer method. O(nlogn)