Abstract
A simple randomized algorithm for generating a uniformly distributed random permutation of size n is investigated. It works in time O( n P + T comm( n P , P) + T prefix(P)) on P processors with high probability, where T comm ( k, P) is the time for randomly sending or receiving k elements on each processor and T prefix ( P) is the time for computing a prefix sum. The algorithm can be directly translated into an optimal external memory algorithm if fast memory for √ nB(1 + o(1)) + O( B) elements is available where B is the page size. Due to its simplicity, the same algorithm even outperforms the straightforward method on mainstream workstations if the cache is taken to be the fast memory and the main memory is treated like external memory. The algorithm is almost four times faster on a MIPS R10000 machine.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have