Over the course of my coding, I have come across a problem as follows: Find the a region of fixed size in a 2D space that has the highest density of particles. The particles can
Divide the region into 1000x1000 and count the number of particles in every (overlapping) 2x2. You can partition them simply by normalizing 0..1, scaling 0..999, and casting to integer. Counts can easily be stored as a 2D array of integers (ushort, uint, or ulong... mmmm tea). This is equivalent to simple 2D spatial partitioning used in broad-phase collision detection.