1. Speed.
+randomShuffle performs O(n) steps and O(n) uniform() calls.
-randomCover performs O(n^2) steps and O(n^2) uniform() calls.

The latter however can (and perhaps should?) be optimized to O(n): in the implementation, the line

Sorry, this part doesn't look clear. O(n^2) total with O(n^2) uniform() calls can be optimized to the same O(n^2) total but with only O(n) uniform() calls. It can be further optimized to O(n log n) total with O(n) uniform() calls using a Fenwick tree, but will then require storing n ints instead of n bools.

Reply via email to