2 ms·
Agreed. Don't see where iteration would be needed here if knowing group size is the actual goal. It looks like a blog post that arrives at "this is essentially
by llarsson 6y ago
Agreed. Don't see where iteration would be needed here if knowing group size is the actual goal.
It looks like a blog post that arrives at "this is essentially what the modulo operator does for you", but with an O(n) algorithm.
However, add a step inside that iterative loop that chooses, at random and without repeats, the actual named employees that will be in these meetings (which I believe will be the point), and none of this matters anyway, since you will wind up with something that is worse than O(n) anyway. You intrinsically have to iterate over the entire list and then, somehow, also choose employees at random, which cannot be "free" in computational terms.