General Permutations: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 36: | Line 36: | ||
[[File:Generating Random Permutations - General Permutations - Space.png|1000px]] | [[File:Generating Random Permutations - General Permutations - Space.png|1000px]] | ||
== | == Space-Time Tradeoff Improvements == | ||
[[File:Generating Random Permutations - General Permutations - Pareto Frontier.png|1000px]] | [[File:Generating Random Permutations - General Permutations - Pareto Frontier.png|1000px]] |
Revision as of 14:36, 15 February 2023
Description
Given an input string/array, generate a single random permutation of the characters/elements of the string/array.
Related Problems
Related: Cyclic Permutations
Parameters
n: number of elements
Table of Algorithms
Name | Year | Time | Space | Approximation Factor | Model | Reference |
---|---|---|---|---|---|---|
Fisher–Yates/Knuth shuffle | 1938 | $O(n^{2})$ | $O(n)$ | Exact | Randomized | Time |
Durstenfeld's Algorithm 235 | 1964 | $O(n)$ | $O({1})$ | Exact | Randomized | Time |
Radix sorting method | 1887 | $O(n)$ | $O(n)$ | Exact | Randomized |