I want to…
std::random_shuffle(begin(a), end(a));
for (auto x : a) {
use(x);
}
…but a
is const
. Is a random-order traversal possible in O(n) time and O(1) space?
I want to…
std::random_shuffle(begin(a), end(a));
for (auto x : a) {
use(x);
}
…but a
is const
. Is a random-order traversal possible in O(n) time and O(1) space?