|
|
|
|
|
by TheLoneWolfling
4042 days ago
|
|
Why O(n log n) space? Because you require O(n) connected components in the worst case, which means that you need O(log n) space per cell in the worst case. Although now that I think about it that pushes the amount of time to O(log n). In practice you can treat it as O(1) time and O(n) space, though. Also, that preprocessing with result saving is substantially slower than the connectivity alone. The connectivity alone is O(n) / O(n log n) preprocessing time - you check each cell a maximum of 5 / 9 times (depending on 4 or 8 way connectivity). Also, that preprocessing with result saving fails miserably when you do updates to the graph. |
|
So it is O(N) in space?
I'm not sure we're talking about the same thing. I mean space requirements for the results of preprocessing.
Preprocessign itself may require computing cluster for all I care.