If we have two arrays of size n each and want to sort their sums, the naive approach would be to store their sums in O(n^2) space and sort it in O(n^2 logn) time. Suppose we're allowed to have the same running time of O(n^2 logn), how would we store the sums in linear space of O(n)?
I suppose we're not intending to store all the sums since they n^2 elements won't fit into n space and that we're merely printing out everything in sorted order, so does this mean that we have to dynamically store the items? Any tips?
(this is a homework problem)