https://github.com/comparison-sorting/odd-even-merge-sort
:musical_score: Batcher's odd-even mergesort algorithm for JavaScript
https://github.com/comparison-sorting/odd-even-merge-sort
agpl algorithms javascript mergesort mergesort-algorithm sorting-algorithms
Last synced: 7 months ago
JSON representation
:musical_score: Batcher's odd-even mergesort algorithm for JavaScript
- Host: GitHub
- URL: https://github.com/comparison-sorting/odd-even-merge-sort
- Owner: comparison-sorting
- License: agpl-3.0
- Created: 2015-07-04T07:55:33.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2024-08-29T12:22:05.000Z (10 months ago)
- Last Synced: 2024-10-02T09:06:42.145Z (9 months ago)
- Topics: agpl, algorithms, javascript, mergesort, mergesort-algorithm, sorting-algorithms
- Language: JavaScript
- Homepage: https://comparison-sorting.github.io/odd-even-mergesort/
- Size: 501 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[@aureooms/js-odd-even-mergesort](https://make-github-pseudonymous-again.github.io/js-odd-even-mergesort)
==
Batcher's odd-even mergesort algorithm for JavaScript.
See [docs](https://make-github-pseudonymous-again.github.io/js-odd-even-mergesort).
Parent is [@aureooms/js-sort](https://github.com/make-github-pseudonymous-again/js-sort).```js
import { whole } from '@aureooms/js-odd-even-mergesort' ;
import { list } from '@aureooms/js-itertools' ;
import { increasing } from '@aureooms/js-compare' ;
import { swap } from '@aureooms/js-array' ;
let modules = list( whole( 4 ) ) ;
modules ; // [ [ 0 , 1 ] , [ 2 , 3 ] , [ 0 , 2 ] , [ 1 , 3 ] , [ 1 , 2 ] ]let a = [ 3 , 1 , 2 , 4 ] ;
for ( let [ i , j ] of modules ) if ( increasing( a[i] , a[j] ) > 0 ) swap( a , i , j ) ;// 3 ----1------1----------- 1
// | |
// 1 ----3------|-3----2---- 2
// | | |
// 2 ------2----2-|----3---- 3
// | |
// 4 ------4------4--------- 4a ; // [ 1 , 2 , 3 , 4 ]
```[](https://raw.githubusercontent.com/make-github-pseudonymous-again/js-odd-even-mergesort/master/LICENSE)
[](https://www.npmjs.org/package/@aureooms/js-odd-even-mergesort)
[](https://travis-ci.org/make-github-pseudonymous-again/js-odd-even-mergesort/branches)
[](https://david-dm.org/make-github-pseudonymous-again/js-odd-even-mergesort)
[](https://david-dm.org/make-github-pseudonymous-again/js-odd-even-mergesort?type=dev)
[](https://github.com/make-github-pseudonymous-again/js-odd-even-mergesort/issues)
[](https://www.npmjs.org/package/@aureooms/js-odd-even-mergesort)[](https://codeclimate.com/github/make-github-pseudonymous-again/js-odd-even-mergesort/issues)
[](https://codeclimate.com/github/make-github-pseudonymous-again/js-odd-even-mergesort/trends/churn)
[](https://codecov.io/gh/make-github-pseudonymous-again/js-odd-even-mergesort)
[](https://codeclimate.com/github/make-github-pseudonymous-again/js-odd-even-mergesort/trends/technical_debt)
[](http://make-github-pseudonymous-again.github.io/js-odd-even-mergesort//source.html)
[](https://bundlephobia.com/result?p=@aureooms/js-odd-even-mergesort)