1.0.3 • Published 1 year ago

binary-search-pakage v1.0.3

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

Binary Search

This npm package provides a simple and efficient implementation of the binary search algorithm in JavaScript.

Installation

To install the package, use npm:

Usage

const binarySearch = require('@your_username/binary-search');

// Example usage: const array = 2, 4, 6, 8, 10, 12, 14, 16; const target = 10; const result = binarySearch(array, target); console.log("Element found at index:", result);

API

binarySearch(arr, target)

This function takes an array arr and a target value target, and returns the index of the target value in the array if found, otherwise -1.

  • arr: The array to be searched.
  • target: The value to search for within the array.
npm install @your_username/binary-search
1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago