Package Exports
- binary-search-js-util
- binary-search-js-util/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (binary-search-js-util) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Binary Search Algorithm
A simple npm package for performing binary search on sorted arrays.
Installation
npm install binary-search-js-utilUsage
const binarySearch = require('binary-search-js-util');
const arr = [1, 3, 5, 7, 9];
const target = 7;
const index = binarySearch(arr, target);
if (index === -1) {
console.log('Target not found');
} else {
console.log('Target found at index', index);
}