Skip to content

peteroreil/bubblesortjs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-bubsort

A node implementation of bubble sort with user defined predicate function

npm install node-bubsort

Usage:

const bubble = require('node-bubsort');

const { result, count } = bubble.sort([2, 1, 3]);
// result => [1, 2, 3]
// count => 2. Count refers to the number of passes of sort.

// sort with a predicate function
    const { result, count } = bubble.sort([
        { key: 5 },
        { key: 1 },
        { key: 4 },
        { key: 2 },
        { key: 8 }
    ], (objOne, objTwo) => objOne.key > objTwo.key);

// result => [ { key: 1 }, { key: 2 }, { key: 4 }, { key: 5 }, { key: 8 }]
// count => 3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published