Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flex-algo

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-algo - npm Package Compare versions

Comparing version 0.1.12 to 0.1.13

2

lib/quickSort.d.ts
export declare function pivot(data: number[], left: number, right: number): number;
export declare function quickSort(data: number[]): void;
export declare function quickSelectPivot(data: number[], left: number, right: number): number;
export declare function quickSelect(data: number[], kth: number): number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.quickSort = exports.pivot = void 0;
exports.quickSelect = exports.quickSelectPivot = exports.quickSort = exports.pivot = void 0;
function swap(data, i, j) {

@@ -32,1 +32,32 @@ var temp = data[i];

exports.quickSort = quickSort;
function quickSelectPivot(data, left, right) {
var p = right;
for (var i = right - 1; i >= left; i--) {
if (data[p] < data[i]) {
swap(data, p - 1, i);
swap(data, p - 1, p);
p -= 1;
}
}
return p;
}
exports.quickSelectPivot = quickSelectPivot;
function _quickSelect(data, left, right, index) {
var p = quickSelectPivot(data, left, right);
if (p === index) {
return data[p];
}
else if (p < index) {
return _quickSelect(data, p + 1, right, index);
}
else {
return _quickSelect(data, left, p - 1, index);
}
}
// 1th index: data.length - 1
// 2th index: data.length - 2
// kth index: data.length - k
function quickSelect(data, kth) {
return _quickSelect(data, 0, data.length - 1, data.length - kth);
}
exports.quickSelect = quickSelect;

2

package.json
{
"name": "flex-algo",
"version": "0.1.12",
"version": "0.1.13",
"description": "\"SDK for commonly used data structure and algorithms\"",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc