Sorry. This post is nonsense. Ignore it. I'll be back with another try later.
Dave On Sep 5, 11:11 am, Dave <dave_and_da...@juno.com> wrote: > Given X(i), i = 1, 2, ..., n and Y(j), j = 1, 2, ..., n, the nth > smallest number of the form X(i) + Y(j) will occur for some i and j > such that i + j = n + 1. Thus, just choose the smallest of X(i) + Y(n > +1-i) as i = 1, 2, ..., n. Time = O(n) and space = O(1). > > Dave > > On Sep 4, 12:03 pm, ankur aggarwal <ankur.mast....@gmail.com> wrote: > > > > > Find nth smallest inO(n) Given two arrays of length n in sorted order > > X[n] & Y[n]. > > Now make another array Z[n^2]={such that z belongs to X+Y}. > > AS all possible sum of x+y is there in Z. You have to give the nth smallest > > no of Z in O(n) time. > > Space complexity : No bound on it. But try to optimize it if possible.- > > Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---