If the point cloud is already "organised" (as would happen for example if it was straight from an RGBD sensor) you may be able to beat O(N) in the best-case by traversing the 2D array cleverly. For information about organizsed point clouds, see https://pcl.readthedocs.io/projects/tutorials/en/latest/basic_structures.html
If the point cloud is not organised then there is no information in the point cloud about the spatial organisation apart from the points themselves, so you will in almost every case have to touch every one of them. If the map is small enough you can exit when it gets full but that is unlikely to happen I guess.
If you are happy with probabilistic results then you can build the map by sampling the point cloud randomly.