Skip to content

Commit

Permalink
💥 BREAKING CHANGE: Remove Ford-Johnson implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Sep 21, 2020
1 parent 52fcf6c commit a08d592
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 129 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ Parent is [@aureooms/js-algorithms](https://github.com/aureooms/js-algorithms).
> working. Documentation may be present. Coherence may be. Maybe.
```js
let fordjohnson = sort._fordjohnson( search.binarysearch ) ;
import {isSorted} from '@aureooms/js-sort';
import {increasing, decreasing} from '@aureooms/js-compare';
isSorted(increasing, [1, 2, 3], 0, 3); // true
isSorted(decreasing, [1, 2, 3], 0, 3); // false
```

[![License](https://img.shields.io/github/license/aureooms/js-sort.svg)](https://raw.githubusercontent.com/aureooms/js-sort/master/LICENSE)
Expand Down Expand Up @@ -39,6 +42,7 @@ This package has several children:
- [aureooms/js-heapsort](https://github.com/aureooms/js-heapsort): heapsort for JavaScript
- [aureooms/js-quicksort](https://github.com/aureooms/js-quicksort): quicksort for JavaScript
- [aureooms/js-insertion-sort](https://github.com/aureooms/js-insertion-sort): Insertion sorting algorithms for JavaScript
- [aureooms/js-merge-insertion-sort](https://github.com/aureooms/js-merge-insertion-sort): Ford-Johnson algorithm for JavaScript
- [aureooms/js-mergesort](https://github.com/aureooms/js-mergesort): mergesort for JavaScript
- [aureooms/js-odd-even-mergesort](https://github.com/aureooms/js-odd-even-mergesort): Batcher's odd-even mergesort for JavaScript
- [aureooms/js-radix-sort](https://github.com/aureooms/js-radix-sort): Radix sorting algorithms for JavaScript
Expand Down
22 changes: 8 additions & 14 deletions doc/manual/example.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
# Examples
```js
import array from "@aureooms/js-array" ;
import search from "@aureooms/js-search" ;
import compare from "@aureooms/js-compare" ;

let fordjohnson = function ( compare , a , i , j ) {

sort._fordjohnson( search.binarysearch )( compare , array.swap , a , i , j ) ;

} ;
import * as sort from "@aureooms/js-sort" ;
import {increasing, decreasing} from "@aureooms/js-compare" ;

let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;
let {selectionsort, isSorted} = sort;

fordjohnson( compare.increasing , a , 0 , a.length ) ;
selectionsort( increasing , a , 0 , a.length ) ;

a ; // [ 1 , 2 , 3 , 4 , 5 , 6 ]
isSorted(increasing, a, 0, a.length); // true

fordjohnson( compare.decreasing , a , 0 , a.length ) ;
selectionsort( decreasing , a , 0 , a.length ) ;

a ; // [ 6 , 5 , 4 , 3 , 2 , 1 ]
isSorted(decreasing, a, 0, a.length); // true

// but also

/** selectionsort */
let selectionsort = sort.selectionsort ;
/** bubblesort */
let bubblesort = sort.bubblesort ;
let {bubblesort} = sort ;
```
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
"@aureooms/js-in-situ-sort-spec": "8.0.0",
"@aureooms/js-itertools": "4.1.0",
"@aureooms/js-random": "2.0.0",
"@aureooms/js-search": "0.0.4",
"@babel/cli": "7.11.6",
"@babel/core": "7.11.6",
"@babel/preset-env": "7.11.5",
Expand Down
93 changes: 0 additions & 93 deletions src/sort/fordjohnson.js

This file was deleted.

1 change: 0 additions & 1 deletion src/sort/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './bubblesort' ;
export * from './fordjohnson' ;
export * from './selectionsort' ;
7 changes: 1 addition & 6 deletions test/src/inplacesort.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import ava from 'ava' ;

import { swap } from "@aureooms/js-array" ;
import { binarysearch } from "@aureooms/js-search" ;
import * as spec from "@aureooms/js-in-situ-sort-spec" ;
import * as sort from "../../src" ;

spec.test( ava , [
[ "selectionsort", sort.selectionsort ],
[ "bubblesort", sort.bubblesort ],
[ "fordjohnson" , function ( compare , a , i , j ) {
sort._fordjohnson( binarysearch )( compare , swap , a , i , j ) ;
} ]
[ "bubblesort", sort.bubblesort ]
] ) ;
9 changes: 1 addition & 8 deletions test/src/whole.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import test from 'ava' ;

import { iota , swap } from "@aureooms/js-array" ;
import search from "@aureooms/js-search" ;
import { shuffle } from "@aureooms/js-random" ;
import * as compare from "@aureooms/js-compare" ;
import * as itertools from "@aureooms/js-itertools" ;
Expand Down Expand Up @@ -51,13 +50,7 @@ itertools.product( [

[
[ "selectionsort", sort.selectionsort ],
[ "bubblesort", sort.bubblesort ],
[ "fordjohnson" , function ( compare , a , i , j ) {

sort._fordjohnson( search.binarysearch )( compare , swap , a , i , j ) ;

} ]

[ "bubblesort", sort.bubblesort ]
],

[
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@
resolved "https://registry.yarnpkg.com/@aureooms/js-random/-/js-random-2.0.0.tgz#f62c6954ed79bd9a520197125ee3cfbe14b00d72"
integrity sha1-9ixpVO15vZpSAZcSXuPPvhSwDXI=

"@aureooms/[email protected]":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@aureooms/js-search/-/js-search-0.0.4.tgz#e7082a7de169c80710924f5292b631a2c1bb9a41"
integrity sha1-5wgqfeFpyAcQkk9SkrYxosG7mkE=

"@aureooms/js-sort@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@aureooms/js-sort/-/js-sort-7.0.0.tgz#db3c8b93acd93ee0500462b2cec29239c3deb34d"
Expand Down

0 comments on commit a08d592

Please sign in to comment.