Skip to content
Merge Sort Algorithm Implementation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json
test.js

README.md




merge-srt : Merge Sort Algorithm Implementation

Overview

In computer science, merge sort is an efficient, general-purpose, comparison-based sorting algorithm. Most implementations produce a stable sort, which means that the implementation preserves the input order of equal elements in the sorted output.

Merge sort is a divide and conquer algorithm that was invented by John von Neumann in 1945. A detailed description and analysis of bottom-up mergesort appeared in a report by Goldstine and von Neumann as early as 1948.

Read More ...

Install

npm install merge-srt

Usage

const mergeSort = require('merge-srt');

let numsArr = [46, 24, 33, 10, 2, 81, 50];
console.log(mergeSort(numsArr));
// => [ 2, 10, 24, 33, 46, 50, 81 ]

let lettersArr = ['d', 'h', 'z', 'a', 'r', 'b', 'i'];
console.log(mergeSort(lettersArr));
// => [ 'a', 'b', 'd', 'h', 'i', 'r', 'z' ]

let wordsArr = ['happy', 'auto', 'energy', 'zoo', 'trigonometry', 'dog', 'foo'];
console.log(mergeSort(wordsArr));
// => [ 'auto', 'dog', 'energy', 'foo', 'happy', 'trigonometry', 'zoo' ]

API

mergeSort(array)

Return a sorted array using merge sort algorithm

Related

Team

Carlos Abraham Logo
Carlos Abraham

License

MIT License © Carlos Abraham

You can’t perform that action at this time.