Nearest neighbor problems on a mesh-connected computer