Algorithms for distributed and mobile sensing