Skip to content

Commit a08d592

Browse files
committedSep 21, 2020
💥 BREAKING CHANGE: Remove Ford-Johnson implementation.
1 parent 52fcf6c commit a08d592

File tree

8 files changed

+15
-129
lines changed

8 files changed

+15
-129
lines changed
 

‎README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ Parent is [@aureooms/js-algorithms](https://github.com/aureooms/js-algorithms).
1111
> working. Documentation may be present. Coherence may be. Maybe.
1212
1313
```js
14-
let fordjohnson = sort._fordjohnson( search.binarysearch ) ;
14+
import {isSorted} from '@aureooms/js-sort';
15+
import {increasing, decreasing} from '@aureooms/js-compare';
16+
isSorted(increasing, [1, 2, 3], 0, 3); // true
17+
isSorted(decreasing, [1, 2, 3], 0, 3); // false
1518
```
1619

1720
[![License](https://img.shields.io/github/license/aureooms/js-sort.svg)](https://raw.githubusercontent.com/aureooms/js-sort/master/LICENSE)
@@ -39,6 +42,7 @@ This package has several children:
3942
- [aureooms/js-heapsort](https://github.com/aureooms/js-heapsort): heapsort for JavaScript
4043
- [aureooms/js-quicksort](https://github.com/aureooms/js-quicksort): quicksort for JavaScript
4144
- [aureooms/js-insertion-sort](https://github.com/aureooms/js-insertion-sort): Insertion sorting algorithms for JavaScript
45+
- [aureooms/js-merge-insertion-sort](https://github.com/aureooms/js-merge-insertion-sort): Ford-Johnson algorithm for JavaScript
4246
- [aureooms/js-mergesort](https://github.com/aureooms/js-mergesort): mergesort for JavaScript
4347
- [aureooms/js-odd-even-mergesort](https://github.com/aureooms/js-odd-even-mergesort): Batcher's odd-even mergesort for JavaScript
4448
- [aureooms/js-radix-sort](https://github.com/aureooms/js-radix-sort): Radix sorting algorithms for JavaScript

‎doc/manual/example.md

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
11
# Examples
22
```js
3-
import array from "@aureooms/js-array" ;
4-
import search from "@aureooms/js-search" ;
5-
import compare from "@aureooms/js-compare" ;
6-
7-
let fordjohnson = function ( compare , a , i , j ) {
8-
9-
sort._fordjohnson( search.binarysearch )( compare , array.swap , a , i , j ) ;
10-
11-
} ;
3+
import * as sort from "@aureooms/js-sort" ;
4+
import {increasing, decreasing} from "@aureooms/js-compare" ;
125

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

15-
fordjohnson( compare.increasing , a , 0 , a.length ) ;
9+
selectionsort( increasing , a , 0 , a.length ) ;
1610

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

19-
fordjohnson( compare.decreasing , a , 0 , a.length ) ;
14+
selectionsort( decreasing , a , 0 , a.length ) ;
2015

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

2319
// but also
2420

25-
/** selectionsort */
26-
let selectionsort = sort.selectionsort ;
2721
/** bubblesort */
28-
let bubblesort = sort.bubblesort ;
22+
let {bubblesort} = sort ;
2923
```

‎package.json

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
"@aureooms/js-in-situ-sort-spec": "8.0.0",
8484
"@aureooms/js-itertools": "4.1.0",
8585
"@aureooms/js-random": "2.0.0",
86-
"@aureooms/js-search": "0.0.4",
8786
"@babel/cli": "7.11.6",
8887
"@babel/core": "7.11.6",
8988
"@babel/preset-env": "7.11.5",

‎src/sort/fordjohnson.js

-93
This file was deleted.

‎src/sort/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
export * from './bubblesort' ;
2-
export * from './fordjohnson' ;
32
export * from './selectionsort' ;

‎test/src/inplacesort.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import ava from 'ava' ;
22

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

86
spec.test( ava , [
97
[ "selectionsort", sort.selectionsort ],
10-
[ "bubblesort", sort.bubblesort ],
11-
[ "fordjohnson" , function ( compare , a , i , j ) {
12-
sort._fordjohnson( binarysearch )( compare , swap , a , i , j ) ;
13-
} ]
8+
[ "bubblesort", sort.bubblesort ]
149
] ) ;

‎test/src/whole.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import test from 'ava' ;
22

33
import { iota , swap } from "@aureooms/js-array" ;
4-
import search from "@aureooms/js-search" ;
54
import { shuffle } from "@aureooms/js-random" ;
65
import * as compare from "@aureooms/js-compare" ;
76
import * as itertools from "@aureooms/js-itertools" ;
@@ -51,13 +50,7 @@ itertools.product( [
5150

5251
[
5352
[ "selectionsort", sort.selectionsort ],
54-
[ "bubblesort", sort.bubblesort ],
55-
[ "fordjohnson" , function ( compare , a , i , j ) {
56-
57-
sort._fordjohnson( search.binarysearch )( compare , swap , a , i , j ) ;
58-
59-
} ]
60-
53+
[ "bubblesort", sort.bubblesort ]
6154
],
6255

6356
[

‎yarn.lock

-5
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@
5454
resolved "https://registry.yarnpkg.com/@aureooms/js-random/-/js-random-2.0.0.tgz#f62c6954ed79bd9a520197125ee3cfbe14b00d72"
5555
integrity sha1-9ixpVO15vZpSAZcSXuPPvhSwDXI=
5656

57-
"@aureooms/js-search@0.0.4":
58-
version "0.0.4"
59-
resolved "https://registry.yarnpkg.com/@aureooms/js-search/-/js-search-0.0.4.tgz#e7082a7de169c80710924f5292b631a2c1bb9a41"
60-
integrity sha1-5wgqfeFpyAcQkk9SkrYxosG7mkE=
61-
6257
"@aureooms/js-sort@^7.0.0":
6358
version "7.0.0"
6459
resolved "https://registry.yarnpkg.com/@aureooms/js-sort/-/js-sort-7.0.0.tgz#db3c8b93acd93ee0500462b2cec29239c3deb34d"

0 commit comments

Comments
 (0)
Please sign in to comment.