@Dinoja: No. You can only binary search for 1 thing, so you would have to choose two elements and then search for the third. Thus, the order would be O(n^2 log n).
Dave On Aug 10, 6:11 pm, Dinoja Padmanabhan <dino...@gmail.com> wrote: > After squaring all the elements up and sorting them, couldn't we just do a > binary search on the array.. so the TC would be O(nlogn)... > > > > > > On Wed, Aug 10, 2011 at 1:18 PM, Kunal Patil <kp101...@gmail.com> wrote: > > @Ankit: Ohh Sorry..I didnt actually read the question properly.. > > I didnt see we have to check for sum which must be another element in the > > array & not some user provided constant value..I mis-understood it with sum > > upto k problem which can be solved on sorted array in O(n)... > > thats why gave a wrong comment...my Bad.. > > > -- > > 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?hl=en. > > -- > > Regards, > Dinoj -- 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?hl=en.