I am dividing a part of a 3D space into a series of 1x1x1 cubes, and that part may have a volume of 100^3 up to 1000^3, however, the cubes/cells I am really interested in rarely exceed 5000-20000 in their numbers.
What I am trying to do is to find all the cells/cubes which satisfy my criteria, adjacent to the chosen one. However, I am not sure what algorithm is the best for such a task. First thing which comes to my mind is to use a regular flood fill algorithm, but the following problem arises: I have to store information about all of the cells in the working area, which as I said may have up to 1000^3 elements, but the ones I need are barely 5000-20000.
So said my questions are:
- If I should use flood fill, is there any data structure which can be used in my case?
- If I shouldn't use flood fill, what should I?