aditya solution is correct it is a standard question of young tabuleau it is complexity is log(n)
On Wed, Jan 5, 2011 at 6:52 PM, ADITYA KUMAR <aditya...@gmail.com> wrote: > @MAC > ur solution is wrong > > 1 9 24 > 2 12 33 > 3 16 49 > > search for 3 > > > O(logn) solution > let the matrix be A[][] and number to be searched is x > divide the array from middle in 4 parts lets say it four quadrants > now check if x>A[n/2][n/2] search in bottom right quadrant > if x<A[n/2][n/2] search in other 3 quadrants > > On Sat, Dec 25, 2010 at 8:25 AM, yq Zhang <zhangyunq...@gmail.com> wrote: > >> Suppose you have a matrix n*m. each column and row of the matrix is >> already sorted. For example: >> >> 1,2,3 >> 2,3,4 >> 4,5,6 >> >> All 3 rows and 3 columns of above matrix are sorted. How to find a >> specific number in the matrix? >> The trivial O(nlogm) solution is to use binary search for all rows. I >> am looking for better solution. >> >> Thanks >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algoge...@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> >> . >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Regards > Aditya Kumar > B-tech 3rd year > Computer Science & Engg. > MNNIT, Allahabad. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- SOURABH JAKHAR,(CSE)(3 year) ROOM NO 167 , TILAK,HOSTEL 'MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.