partitionSelect.js 762 B

123456789101112131415
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.partitionSelectDocs = void 0;
  6. var partitionSelectDocs = {
  7. name: 'partitionSelect',
  8. category: 'Matrix',
  9. syntax: ['partitionSelect(x, k)', 'partitionSelect(x, k, compare)'],
  10. description: 'Partition-based selection of an array or 1D matrix. Will find the kth smallest value, and mutates the input array. Uses Quickselect.',
  11. examples: ['partitionSelect([5, 10, 1], 2)', 'partitionSelect(["C", "B", "A", "D"], 1, compareText)', 'arr = [5, 2, 1]', 'partitionSelect(arr, 0) # returns 1, arr is now: [1, 2, 5]', 'arr', 'partitionSelect(arr, 1, \'desc\') # returns 2, arr is now: [5, 2, 1]', 'arr'],
  12. seealso: ['sort']
  13. };
  14. exports.partitionSelectDocs = partitionSelectDocs;