MCPcopy Create free account
hub / github.com/TheAlgorithms/JavaScript / RandomizedPartition

Function RandomizedPartition

Data-Structures/Array/QuickSelect.js:34–38  ·  view source on GitHub ↗
(items, left, right)

Source from the content-addressed store, hash-verified

32}
33
34function RandomizedPartition(items, left, right) {
35 const rand = getRandomInt(left, right)
36 Swap(items, rand, right)
37 return Partition(items, left, right)
38}
39
40function Partition(items, left, right) {
41 const x = items[right]

Callers 1

RandomizedSelectFunction · 0.85

Calls 3

getRandomIntFunction · 0.85
SwapFunction · 0.85
PartitionFunction · 0.85

Tested by

no test coverage detected