In a laboratory housed in kotebe micro-organisms were arranged in a n × n grid for studying purpose. By accident one of the laboratory technicians spills an infectious virus on some of the organism.This virus has the ability to infect the organism located immediately (east, west, north and south) of its already infected organism in 3 microseconds.
How many microseconds does it take for a virus spilled at the center(i=j) of an 1 1 × 1 1 grid to infect all the organisms.
Details and Assumptions
-Explicit example, 0 means infected and 1 means normal. If the virus was spilled on the center of a 3 × 3 grid.
⎝ ⎛ 1 1 1 1 0 1 1 1 1 ⎠ ⎞ ⟶ 3 μ s ⎝ ⎛ 1 0 1 0 0 0 1 0 1 ⎠ ⎞ ⟶ 3 μ s ⎝ ⎛ 0 0 0 0 0 0 0 0 0 ⎠ ⎞
For a total of 6 microseconds.
The time between getting infected and infecting others is negligible.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Problem Loading...
Note Loading...
Set Loading...
Notice that the expanding area is a tilted square . After the n th iteration , it will have a side length of size n . The number of iterations until the matrix is filled is thus the size of the largest diagonal of the matrix. For a square matrix n × n where n is odd, the largest diagonal is equal to n . The total time T it takes for the region to fully fill an odd square matrix with side length N is:
T = 3 ( N − 1 ) μ s