n elements (left part) and a min-heap for the largest n elements (right part).n elements and the last n elements, and add them to their respective heaps.n-th element to the (2n-1)-th element, updating the heaps and sums accordingly.n elements and update the minimum difference if necessary.