-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does the 2d to 1d conversion work #3
Comments
@vnyapathi what problem are you referring to? |
The percolation problem.
…Sent from my iPhone
On 28 Jan 2019, at 02:30, Alex Ilyenko ***@***.***> wrote:
@vnyapathi what problem are you referring to?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I'm a bit out of context over here, since I was working on this 4 years ago, but let's see what we can figure out. Basically, you're referring to the function which transforms two-dimensional array into the one-dimensional one. So if you have something like that:
it means
Let's move row by row. Second row ( Third row ( Fourth row ( I think the confusing part for any Java engineer over here would be that we start counting from Without that condition you could use the corrected formula as follows: Hope that helps! |
N * (y - 1) + x - 1; Can you explain how this works for 0,0 and a 5by5 grid. Won't it be something like -6.
The text was updated successfully, but these errors were encountered: