Notoriously Problematic Merge

npm

Have ideas to improve npm?Join in the discussion! »

node-sort-algorithms

1.1.5 • Public • Published

Node-Sort-Algorithms

A sorting library for Node.js & javascript made based on well kown algorithmes included : Bead Sort , Gravity Sort , Bucket Sort , Bin Sort , Counting Sort , Insertion Sort , Merge Sort , Radix Sort

Sorting algorithm is an algorithm that puts elements of a list in a certain order. The most-used orders are numerical order and lexicographical order. Efficient sorting is important for optimizing the use of other algorithms (such as search and merge algorithms) which require input data to be in sorted lists; it is also often useful for canonicalizing data and for producing human-readable output. More formally, the output must satisfy two conditions:

The output is in nondecreasing order (each element is no smaller than the previous element according to the desired total order); The output is a permutation (reordering) of the input.

Sorting Algorithm !
Class Sorting Algorithm
Data structure	Array
**Comparison sorts*
Insertion Sort
Tim Sort
Merge Sort
Merge Sort 3 Way
Quick Sort
Quick Sort 3 Way
Selection Sort
Shell Sort
Bubble Sort
Bubble Sort Optimized
Cocktail Sort
Heap Sort
**Non-comparison sorts**
Gravity Sort
Bucket Sort
Bin Sort
Counting Sort

TODO .............................................
**Comparison sorts**
Intro Sort
Cube Sort
In-place merge Sort
Binary tree Sort
Cycle Sort
Library Sort
Patience Sorting
Smooth Sort
Strand Sort
Tournament Sort
Comb Sort
Gnome Sort
UnShuffle Sort[10]
Franceschini method Sort
Block Sort
Odd-Even Sort
**Non-comparison sorts**
Pigeonhole Sort
Bucket Sort(uniform keys)
Bucket Sort(integer keys)
Burst Sort
Flash Sort
Postman Sort

Note: the output must satisfy two conditions:
The output is in nondecreasing order (each element is no smaller
than the previous element according to the desired total order);
The output is a permutation (reordering) of the input.

Author: Amir Hatami

Installation

Install using the node.js package manager npm:

\$ npm install node-sort-algorithms

Install via git clone:

\$ git clone https://github.com/amhatami/Node-Sort-Algorithms node-sort-algorithms
\$ cd node-sort-algorithms
\$ npm install

Using directly via a browser, You can download node-sort-algorithms.js from GitHub or just bellow hotlink to it:

<script src="https://raw.githubusercontent.com/amhatami/Node-Sort-Algorithms/master/node-sort-algorithms.js"></script>

Requirements

You can install node-sort and its dependencies with npm:

\$ npm install node-sort-algorithms

Dependencies

Ruls :

• Depended on the Sort algorithms, input Array could be integers, float, decima, ocat, hex or binary.
• Array's element could be negative for only these Algorithms; Insertion Sort , Merge Sort , 3 Way Merge Sort , Quick Sort , 3 Way Quick Sort and etc.
• Turn On details of Algorithms progress useing : displaymode = "Yes"

Example

Demos of the node-sort module are located in: ./test-Cases

API Documentation

Parameters

• array - array to be sorted
• displaymode - for more details of algorithm progress
• base - for positional numeral system with a radix, or base e.g.(2 Binary - 8 Octal - 10 Decimal - 16 Hexadecimal - 60 Sexagesimal etc. ) List of numeral systems

Functions

**Comparison sorts**

• Insertion Sort - .insertionSort( array )

• Merge Sort - .mergeSort( array )

• Merge Sort 3 Way - .mergeSort3Way( array )

• Quick Sort - .quickSort( array )

• Quick Sort 3 Way - .quickSort3Way( array )

• Tim Sort - .timSort( array )

• Selection Sort - .selectionSort( array )

• Shell Sort - .shellSort( array )

• Bubble Sort - .bubbleSort( array )

• Bubble Sort Optimized - .bubbleSortOptimized( array )

• Cocktail Sort - .cocktailSort( array )

• Heap Sort - .heapSort( array )

**Non-comparison sorts**

• Counting Sort - .countingSort( array )

• Bucket Sort (integer keys) - .bucketSort( array )

• Bin Sort - .binSort( array )

• Gravity Sort - .gravitySort( array )

Coming soon :) !

• Intro Sort - .introSort( array )

• Cube Sort - .cubeSort( array, [comparator] )

TODO ............................................. Comparison sorts Intro Sort

Cube Sort

Shell Sort

In-place merge Sort

Binary tree Sort

Cycle Sort

Library Sort

Patience Sorting

Smooth Sort

Strand Sort

Tournament Sort

Comb Sort

Gnome Sort

UnShuffle Sort[10]

Franceschini method Sort

Block Sort

Odd-Even Sort

Non-comparison sorts

Pigeonhole Sort

Bucket Sort(uniform keys)

Burst Sort

Flash Sort

Postman Sort

Testing

Issue the following node command in the same directory to run the UnitTest.js test cases:

\$ node UnitTest

node-sort-algorithms: Copyright (c) 2016 Amir Hatami

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Refrences

Install

npm i node-sort-algorithms

2

1.1.5