i cant find xact soln on previous thread????i have sol with n*n complexity
 but used space,, i.e

scan whole matrix
if( matrix([i][j]==1)
{
row[i]=1;
col[j]=1;
}

scan agin
if(row[i]==1 ||| col[j]==1)
matrix[i][j]=0;


two n*n loops so takes n*n and uses space too plz give me opt. soln

On Fri, Sep 30, 2011 at 3:08 PM, Yogesh Yadav <medu...@gmail.com> wrote:

> Already discussed
>
>
> https://groups.google.com/group/algogeeks/browse_thread/thread/8a3e1a6665702f54/66bb2e804b43ae1d?hl=en&lnk=gst&q=MS+question+ankur#66bb2e804b43ae1d
>
> .....
>
>
> On Fri, Sep 30, 2011 at 2:59 PM, sumit kumar pathak <sumitkp1...@gmail.com
> > wrote:
>
>> *find all the zeros in first iteration and store (size = array bool [2n])
>> *
>> *and then make zero. *
>> *time = O(n^2)*
>> *space = O(n)*
>> *
>> *
>> *case 2:*
>> * if any zero whole matrix zero, (once we get a zero its row and column
>> will become zero which in turn lead to whole matrix being zero).
>> *
>> *
>> *regards
>> - Sumit Kumar Pathak
>> (Sumit/ Pathak/ SKP ...)
>> *Smile is only good contagious thing.*
>> *Spread it*!!!!!
>>
>>
>>
>>
>> On Fri, Sep 30, 2011 at 2:38 PM, rahul sharma <rahul23111...@gmail.com>wrote:
>>
>>> it will zero only row not column
>>>
>>> On Fri, Sep 30, 2011 at 12:25 PM, Tamanna Afroze <afroze...@gmail.com>wrote:
>>>
>>>>
>>>> if(matrix[i][j]==0){
>>>>       for(int j=0;j<n;j++)
>>>>            matrix[i][j]=0;
>>>> }
>>>>
>>>> --
>>>> 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.
>>>>
>>>
>>>  --
>>> 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.
>>>
>>
>>  --
>> 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.
>>
>
>  --
> 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.
>

-- 
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.

Reply via email to