binary-search-js-sarkar
v1.0.1
Published
A lightweight, zero-dependency JavaScript utility that performs fast and efficient binary search on sorted arrays.
Readme
🔍 binary-search-js-sarkar
A lightweight, zero-dependency JavaScript utility that performs fast and efficient binary search on sorted arrays.
📦 Installation
npm install binary-search-js-sarkar
2. Import the function
const binarySearch = require('binary-search-js-sarkar');
3. Use it on a sorted array
const arr = [1, 3, 5, 7, 9, 11];
const target = 7;
const result = binarySearch(target, arr);
console.log(result); // Output: 3
⚠️ Make sure the array is sorted in ascending order.