@bemoje/arr-partition-index
Linear-time Partitioning. Runtime: O(n). Chooses a pivot and re-arrages the array so that everything on the left is <= pivot and everything on the right is > pivot
Version
Travis CI
Dependencies
Stats
Donate
Installation
npm install @bemoje/arr-partition-index
npm install --save @bemoje/arr-partition-index
npm install --save-dev @bemoje/arr-partition-index
Usage
import arrPartitionIndex from '@bemoje/arr-partition-index'
const arr = [1, 2, 3, 4]
arrPartitionIndex(arr, 1, 2)
//=> 1
Tests
Uses Jest to test module functionality. Run tests to get coverage details.
npm run test
API
arrPartitionIndex
Linear-time Partitioning. Runtime: O(n). Chooses a pivot and re-arrages the array so that everything on the left is <= pivot and everything on the right is > pivot
Parameters
Returns
number pivot index