1.0.1 • Published 1 year ago

binary_search03 v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Binary Search

A simple binary search algorithm implementation for JavaScript.

Installation

You can install the package via npm:

npm install @your-username/binary-search
const binarySearch = require('@your-username/binary-search');

const arr = [1, 3, 5, 7, 9];
const target = 5;
const index = binarySearch(arr, target);

if (index !== -1) {
  console.log(`Element ${target} found at index ${index}`);
} else {
  console.log(`Element ${target} not found`);
}
1.0.1

1 year ago

1.0.0

1 year ago