[algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
if matrix [i][j]=0 then entire row n column should be set to zero with min tym n space complexity.o(n) tym n o (1) space -- 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

Re: [algogeeks] urgent soln needed

2011-09-30 Thread Tamanna Afroze
if(matrix[i][j]==0){ for(int j=0;jn;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

Re: [algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
it will zero only row not column On Fri, Sep 30, 2011 at 12:25 PM, Tamanna Afroze afroze...@gmail.comwrote: if(matrix[i][j]==0){ for(int j=0;jn;j++) matrix[i][j]=0; } -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To

Re: [algogeeks] urgent soln needed

2011-09-30 Thread sumit kumar pathak
*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 -

Re: [algogeeks] urgent soln needed

2011-09-30 Thread Yogesh Yadav
Already discussed https://groups.google.com/group/algogeeks/browse_thread/thread/8a3e1a6665702f54/66bb2e804b43ae1d?hl=enlnk=gstq=MS+question+ankur#66bb2e804b43ae1d . On Fri, Sep 30, 2011 at 2:59 PM, sumit kumar pathak sumitkp1...@gmail.comwrote: *find all the zeros in first iteration and

Re: [algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
provide me with o(1) space ...i need it vey urgent.can it be done...thnx in advance. On Fri, Sep 30, 2011 at 3:44 PM, rahul sharma rahul23111...@gmail.comwrote: sorry n*m complex where n rows and m col but correct for space pzl and it uses two xtras array row and col On Fri, Sep 30,

Re: [algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
i cant find xact soln on previous threadi 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,

Re: [algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
sorry n*m complex where n rows and m col but correct for space pzl and it uses two xtras array row and col On Fri, Sep 30, 2011 at 3:42 PM, rahul sharma rahul23111...@gmail.comwrote: i cant find xact soln on previous threadi have sol with n*n complexity but used space,, i.e scan whole

Re: [algogeeks] urgent soln needed

2011-09-30 Thread Ankur Garg
@Rahul Scan the matrix and whenver u see a[i][j]=0 put a[i]]0]=0 and a[0][j]=0 Meaning to say that put that row or column as 0 Now, Scan the first row and first column and whereever u see a 0 make that column and row 0 respectively Eg 1 1 1 1 0 1 0 1 1 1 1 0 Answer shud be 0 1 0 0 0 0 0 0

Re: [algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
plz xplain result after first scaning On Fri, Sep 30, 2011 at 5:05 PM, Ankur Garg ankurga...@gmail.com wrote: @Rahul Scan the matrix and whenver u see a[i][j]=0 put a[i]]0]=0 and a[0][j]=0 Meaning to say that put that row or column as 0 Now, Scan the first row and first column and

Re: [algogeeks] urgent soln needed

2011-09-30 Thread rahul sharma
i cnt get logic...xplain mre.thnx in advnce On Fri, Sep 30, 2011 at 6:16 PM, rahul sharma rahul23111...@gmail.comwrote: plz xplain result after first scaning On Fri, Sep 30, 2011 at 5:05 PM, Ankur Garg ankurga...@gmail.com wrote: @Rahul Scan the matrix and whenver u see a[i][j]=0 put