New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

js-data-structures-algorithms

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-data-structures-algorithms - npm Package Compare versions

Comparing version 1.1.0 to 1.1.2

__tests__/DoublyLinkedList.test.js

29

algorithms/binarySearch.js

@@ -19,22 +19,21 @@ function binarySearchRecursive(n, arr) {

function binarySearch(n, list) {
let minIndex = 0;
let maxIndex = list.length - 1;
function binarySearch(n, collection) {
const not_found = -1;
let currentIndex;
let currentMidpoint;
size = collection.length;
left = 0;
right = size - 1;
while (minIndex <= maxIndex) {
currentIndex = Math.floor((minIndex + maxIndex) / 2);
currentMidpoint = list[currentIndex];
if (currentMidpoint < n) {
minIndex = currentIndex + 1;
} else if (currentMidpoint > n) {
maxIndex = currentIndex - 1;
while (left <= right) {
midpoint = Math.floor((left + right) / 2);
if (collection[midpoint] < n) {
left = midpoint + 1;
} else if (collection[midpoint] > n) {
right = midpoint - 1;
} else {
return currentIndex;
return midpoint;
}
}
return -1;
return not_found;
}

@@ -41,0 +40,0 @@

{
"name": "js-data-structures-algorithms",
"description": "Project for showing different data structures and algorithms implemented in Javscript. Not exhaustive, mostly exploratory in nature and for career development. If you see anything wrong, let me know!",
"version": "1.1.0",
"version": "1.1.2",
"main": "index.js",

@@ -17,8 +17,3 @@ "scripts": {

},
"keywords": [
"data",
"structures",
"algorithms",
"javascript"
],
"keywords": ["data", "structures", "algorithms", "javascript"],
"author": "Darren Jennings",

@@ -40,10 +35,11 @@ "license": "MIT",

},
"czConfig": {
"path": "cz-conventional-changelog"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
},
"ghooks": {
"pre-commit": "yarn test"
}
}
}
},
"dependencies": {}
}
# Data structures and Algorithms - Javascript
[![Travis](https://img.shields.io/travis/darrenjennings/js-data-structures-algorithms.svg?style=flat-square)](https://travis-ci.org/darrenjennings/js-data-structures-algorithms)
[![Coverage](https://img.shields.io/codecov/c/github/darrenjennings/js-data-structures-algorithms.svg?style=flat-square)](https://codecov.io/gh/darrenjennings/js-data-structures-algorithms)
[![Coverage](https://img.shields.io/codecov/c/github/darrenjennings/js-data-structures-algorithms.svg?style=flat-square)](https://travis-ci.org/darrenjennings/js-data-structures-algorithms)
[![Npm](https://img.shields.io/npm/v/js-data-structures-algorithms.svg?style=flat-square)](https://www.npmjs.com/package/js-data-structures-algorithms)

@@ -6,0 +6,0 @@ [![MIT License](https://img.shields.io/npm/l/js-data-structures-algorithms.svg?style=flat-square)](https://www.npmjs.com/package/js-data-structures-algorithms)

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