I have some questions in case 2 questions inlined..
Thanks and regards,
K.V.Chandra kumar.
On 22/11/2007, Dave [EMAIL PROTECTED] wrote:
Case 1
Start:
0 1 1
1 1 1
1 1 1
After first scan:
0 1 0
1 1 1
0 1 1
After second scan:
0 1 0
0 1 1
0 1 1
After third scan:
0 0 0
0 1 1
Hi
James, your approach is cool, The bitmap approach works in O(n),
but as mention by dave, it take extra memory and initialization.
If we dont want to use extra memory, can it be done in O(n)?
Thank You
MJ
On Nov 21, 8:11 pm, Dave [EMAIL PROTECTED] wrote:
Okay. This works better. It is
Hi, as I understood the question goes like this (I also face this problem
earlier)...
* Given an array of 0s and 1s (whether the array can contain any other
element apart from 0 and 1 is not mentioned in the question posted, but to
make it hard people say that the array cannot hold element
Call or Send SMS to any phone anywhere in the world Free! -
http://offr.biz/HLGB7321740QUQKUQA
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
I was pretty careless with cut and paste from Case 1. Let's try Case 2
again
Start:
1 1 0
1 1 1
0 1 1
After first scan:
1 1 0
1 1 1
0 1 0
After second scan:
0 1 0
0 1 1
0 1 0
After third scan:
0 0 0
0 1 1
0 1 0
It looks like I need a 4th step. If the lower right element is zero,
zero the last
Then the case
1 1 1
1 1 1
0 1 1
Scan I
1 1 1
1 1 1
0 1 0
Scan II
0 1 1
0 1 1
0 1 0
Scan III
0 1 1
0 1 1
0 0 0 this will the right answer, but cosidering next case, we get
Scan IV
0 1 0
0 1 0
0 0 0
Hi James,
As per your solution the variable pair can go negative and if Array[i]
X,
and in that case you can not use bitmap[pair] which will give an
exception as we can not access the array elements using -ve value.
SO how will you take care of -ve values of variable pair...
pair = X -
HI Chandra,
As per the problem statement
Given an array of 0's and 1's whenever you encounter an 0 make
corresponding column and row elements 0.
Does it mean make all the rows and column zero or only last row and
column elemnt zero??
could you reframe the problem statement with more details
http://www.moneycosmos.com/?r=321740
--~--~-~--~~~---~--~~
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