basic-dsa-algo
v2.1.1
Published
A Package with DSA Searching and Sorting functions in js.
Downloads
11
Maintainers
Readme
The Basic-DSA-Algo
is a Node.js package that provides basic data structures and algorithms commonly used in computer science.
Installation ⚒️
You can install Basic-DSA-Algo
using npm. Run the following command:
npm install basic-dsa-algo
Package Structure 📂
Usage 💡
// importing function
const { binarySearch } = require('basic-dsa-algo');
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 in the array`);
}
Element 5 found at index 2