solution 1: use concept of quad-tree and do binary search in that tree solution 2: do binary search on major diagonal. ultimately u will narrow down to search for element in 2 rows. in these two rows again do binary search.
any solution will lead you to O(log(n)) time On Tue, Sep 21, 2010 at 5:10 PM, jagadish <[email protected]> wrote: > Hi all, > Given a 2d array which is sorted row wise and column wise as well, > find a specific element in it in LESS THAN O(n). > PS: an O(n) solution would involve skipping a column or a row each > time from the search and moving accordingly. > Solution less than O(n) is desirable! > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thanks & Regards, Saurabh -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
