just traverse the three rows and get the max and min out of the three rows . print the row in which their is no max and min .
On Mon, Aug 15, 2011 at 1:02 AM, aditya kumar <[email protected]>wrote: > yes > > > On Mon, Aug 15, 2011 at 12:58 AM, aditi garg <[email protected]>wrote: > >> @shady : does O(3n) include the time required to find the max and min >> element as well?? >> >> >> On Mon, Aug 15, 2011 at 12:50 AM, shady <[email protected]> wrote: >> >>> no it is 3*n only........ read it again >>> >>> >>> On Mon, Aug 15, 2011 at 12:45 AM, Amir Aavani <[email protected]>wrote: >>> >>>> >>>> On 08/14/2011 11:46 AM, aditya kumar wrote: >>>> >>>>> it can be done in O(3n). in worst case one row will have max and anothr >>>>> row >>>>> will have min so the third row will be your o/p to print >>>>> >>>> Do you mean O(n^3)? >>>> >>>> Consider this { O(n^2) }: >>>> >>>> 1- Scan the whole matrix and find minimum and maximum entries in the >>>> matrix. Let Delta be the difference between maximum and minimum. >>>> 2- For each row, find the minimum and maximum entries in that row. If >>>> their difference is exactly Delta, then print that row. >>>> >>>> >>>> Amir >>>> >>>> >>>> >>>>> On Mon, Aug 15, 2011 at 12:00 AM, Karthikeyan palani< >>>>> [email protected]> wrote: >>>>> >>>>> sorry O(n^2) s the time complexity >>>>>> >>>>>> >>>>>> On 14 August 2011 23:56, shady<[email protected]> wrote: >>>>>> >>>>>> how can it be O(n) when there are itself n*n elements.. >>>>>>> >>>>>>> PS : no sharing of code, else the inevitable >>>>>>> >>>>>>> On Sun, Aug 14, 2011 at 11:51 PM, Karthikeyan palani< >>>>>>> [email protected]> wrote: >>>>>>> >>>>>>> Given a n x n matrix. .number are randomly placed. .print any one >>>>>>>> row >>>>>>>> which doesn’t have min >>>>>>>> and max elements. Time Complexity : 0(n) >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> if anyone know the code.. pls share!!! >>>>>>>> >>>>>>>> -- >>>>>>>> karthikeyankkn >>>>>>>> >>>>>>>> -- >>>>>>>> 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 >>>>>>>> algogeeks+unsubscribe@**googlegroups.com<algogeeks%[email protected]> >>>>>>>> . >>>>>>>> For more options, visit this group at >>>>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en> >>>>>>>> . >>>>>>>> >>>>>>>> >>>>>>> -- >>>>>>> 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 >>>>>>> algogeeks+unsubscribe@**googlegroups.com<algogeeks%[email protected]> >>>>>>> . >>>>>>> For more options, visit this group at >>>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en> >>>>>>> . >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> karthikeyankkn >>>>>> >>>>>> -- >>>>>> 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 >>>>>> algogeeks+unsubscribe@**googlegroups.com<algogeeks%[email protected]> >>>>>> . >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/**group/algogeeks?hl=en<http://groups.google.com/group/algogeeks?hl=en> >>>>>> . >>>>>> >>>>>> >>>>> >>>> -- >>>> 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 algogeeks+unsubscribe@** >>>> googlegroups.com <algogeeks%[email protected]>. >>>> For more options, visit this group at http://groups.google.com/** >>>> group/algogeeks?hl=en <http://groups.google.com/group/algogeeks?hl=en>. >>>> >>>> >>> -- >>> 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. >>> >> >> >> >> -- >> Aditi Garg >> Undergraduate Student >> Electronics & Communication Divison >> NETAJI SUBHAS INSTITUTE OF TECHNOLOGY >> Sector 3, Dwarka >> New Delhi >> >> >> -- >> 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. >> > > -- 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.
