Skip to content

This is Linear and Binary search algorithm in Javscript

Notifications You must be signed in to change notification settings

opensourcedj217/JSSearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

@ds-javascript/search

Usage

const Search = require('@ds-javascript/search');
const search = new Search()

API

.linear(array,element) It performs linear search on array and finds a given element.
Returns index of element if found otherwise -1.

search.linear([34,51,1,2,3,45,56,687], 45)

.binary(array,element) It performs binary search on array and finds a given element.
Returns index of element if found otherwise -1.
Array needs to be in sorted order then only binary search will return valid result.

search.binary([1,2,3,34,45,51,56,687], 45)

About

This is Linear and Binary search algorithm in Javscript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published