skk-binsearch

javascript binSearch

Usage no npm install needed!

<script type="module">
  import skkBinsearch from 'https://cdn.skypack.dev/skk-binsearch';
</script>

README

skk-binSearch

Build Status npm version
A small module named binSearch to find a specified data from a sorted Array.

Example

install

  npm install --save skk-binSearch

usage

  var binSearch = require('binSearch');

  var sortedArr = [1,3,6,7,12,54,67,123];

  // If not find specified data from arr, return null
  binSearch(sortedArr, 10); // null
  // If find specified data, return a array
  binSearch(sortedArr, 6);
  // [0:10, index:2, input:[1,3,6,7,12,54,67,123], count:2]