General Permutations (Generating Random Permutations)

From Algorithm Wiki
Revision as of 11:21, 15 February 2023 by Admin (talk | contribs) (Created page with "{{DISPLAYTITLE:General Permutations (Generating Random Permutations)}} == 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 == <pre>n: number of elements</pre> == Table of Algorithms == {| class="wikitable sortable" style="text-align:center;" width="100%" ! Name !! Year !! Time !! Space !! Approximation Factor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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

Time Complexity graph

Generating Random Permutations - General Permutations - Time.png

Space Complexity graph

Generating Random Permutations - General Permutations - Space.png

Pareto Decades graph

Generating Random Permutations - General Permutations - Pareto Frontier.png