Nobody Picked Me

    @andreas-hum/arraysorter

    1.2.5 • Public • Published

    @andreas-hum/arraysorter NPM version NPM monthly downloads NPM total downloads

    A package containing many different sorting algorithms for sorting arrays or key pair arrays.

    Getting Started

    Prerequisites

    The latest version of npm or yarn
    

    Installing

    npm i @andreas-hum/arraysorter
    
    yarn add @andreas-hum/arraysorter
    

    Usage

    const sort = require('.arraysorter');
    
    let sortedArr = sort.introSort([2,4,1,3,5]);
    console.log(sortedArr);
    //Output [1,2,3,4,5]
    
    let sortedArrAsc = sort.cocktailSort([2,4,1,3,5],'asc');
    console.log(sortedArrAsc);
    //Output [5,4,3,2,1]
    
    let keySort = sort.mergeSort([{ 'key': 'foo' }, { 'key': 'bar' }], 'des', 'key')
    console.log(keySort);
    //Output [{ 'key': 'bar' },{ 'key': 'foo' }];

    List of current sorting algorithms implemented: key+ means that the algorithm can sort via keys

    • Comparison sorts

      • Bubble - key+
      • Bingo - key+
      • Comb - key+
      • Cycle - key+
      • Cocktail - key+
      • Gnome - key+
      • (max) Heap - key+
      • (min) Heap - key+
      • Insertion - key+
      • (Binary) Insertion
      • Introspective
      • Merge - key+
      • Odd even - key+
      • Patience
      • Quick
      • (double) Selection - key+
      • Selection - key+
      • Shell - key+
      • Tim
    • Non-comparison sorts

      • Bucket - key+
      • Counting
      • Flash
      • (LSD) Radix
      • Pigeonhole
    • Other

      • Bogo
      • Gravity
      • Stooge

    List of current helper functions implemented

    • Binary search
    • Execution time for functions or sorting methods
    • Get max element index
    • Get position of a number
    • (min) Heapify
    • (max) Heapify
    • Partition operation
    • Random array creater
    • Swap array elements

    References

    Author

    License

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

    Install

    npm i @andreas-hum/arraysorter

    DownloadsWeekly Downloads

    0

    Version

    1.2.5

    License

    ISC

    Unpacked Size

    79 kB

    Total Files

    3

    Last publish

    Collaborators

    • andreas-hum