npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

algo-helper

v2.0.0

Published

A Javascript algorithms library.

Downloads

4

Readme

algo-helper

"algo-helper" is a javascript algorithms library which allows you to use various kind of sorting and searching algorithms in your project very easily. Our next version will be mainly focusing on Graphs.

Installation

Using npm:

$ npm i -g npm
$ npm i algo-helper

Note: add --save if you are using npm < 5.0.0

How to migrate from v1.0.0 to v2.0.0?

v1.0.0

// Load the build.
import { sort, search } from 'algo-helper'

v2.0.0

// Load the build.
import _algo from 'algo-helper'

Usage:

v1.0.0

// Load the build.
import { sort, search } from 'algo-helper'

let arr = [3,4,7,1,78,54,23]
// Use sort method.
let sortedArray = sort.bubbleSort(arr)

v2.0.0

// Load the build.
import _algo from 'algo-helper'

let arr = [3,4,7,1,78,54,23]
// Use sort method.
let sortedArray = _algo.bubbleSort(arr)

How to import?

ES6:

// Load the build.
import _algo from 'algo-helper'

let arr = [3,4,7,1,78,54,23]
// Use sort method.
let sortedArray = _algo.bubbleSort(arr)

// Use search method.
let index = _algo.linearSearch(arr,7)

In Node.js:

// Load the build.
var _algo = require('algo-helper');

var arr = [3,4,7,1,78,54,23]
// Use sort method.
var sortedArray = _algo.bubbleSort(arr)

// Use search method.
var index = _algo.linearSearch(arr,7)

Example

How to use 'sort' in ES6?

import _algo from 'algo-helper'

const arr = [3,2,34,65,1,8,54]

// How to use bubble sort
let bubbleSortedArr = _algo.bubbleSort(arr)
// console.log(bubbleSortedArr) 
// [1, 2, 3, 8, 34, 54, 65]

// How to use insertion sort
let insertionSortedArr = _algo.insertionSort(arr) 

// How to use selection sort
let selectionSortedArr = _algo.selectionSort(arr) 

// How to use quick sort
/**
 * @param {array} [array=[]] The array to inspect.
 * @param {number1} [number] The number selected from left
 * @param {number2} [number] The number selected from right
 * _algo.quickSort(array, number1, number2) 
 */
let quickSortedArr = _algo.quickSort(arr, 1, 5) 

// How to use merge sort
let mergeSortedArr = _algo.mergeSort(arr) 

// How to use heap sort
let heapSortedArr = _algo.heapSort(arr)

How to use 'search' in ES6?

In searching, you can give the input array as an unsorted array. If the number you are looking for is not available in the array, the output will be -1. Otherwise, you will get the index of the number you have entered.

import _algo from 'algo-helper'

const arr = [3,2,34,65,1,8,54]

// How to use linear search
/**
 * @param {array} [array=[]] The array which is not sorted
 * @param {number1} [number] The number to find
 * _algo.quickSort(array, number1, number2) 
 */
let foundIndexLs = _algo.linearSearch(arr,1)

// How to use binary search
/**
 * @param {number} [number] The number to find
 * @param {arr} [array=[]] The array which is not sorted
 * _algo.quickSort(array, number1, number2) 
 */
let foundIndexBs = _algo.binarySearch(34,arr)

Why algo-helper?

Algo-helper makes JavaScript easier by taking the hassle out of working with algorithms. Algo-helper’s modular methods are great for:

  • Searching in arrays
  • Sorting arrays
  • Create Graphs/ Linked list (next version)
  • Graph search (next version)

Author

Dushan Ranasinghe - Full Stack Javascript Developer

Feel free to visit my Github account: dushanranasinghe

License

This project is licensed under the MIT License - see the LICENSE.md file for details