Skip to content

Commit f981fed

Browse files
author
Aurélien Ooms
committed
Update README.md
1 parent 21ef05e commit f981fed

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,28 @@ This package has several children:
4343
## Use
4444

4545
```js
46+
let array = require( "aureooms-js-array" ) ;
47+
let search = require( "aureooms-js-search" ) ;
4648
let compare = require( "aureooms-js-compare" ) ;
4749

48-
/** quicksort using hoare partitioning */
49-
let quicksort = sort.__quicksort__( sort.hoare ) ;
50+
let fordjohnson = function ( compare , a , i , j ) {
51+
52+
sort._fordjohnson( search.binarysearch )( compare , array.swap , a , i , j ) ;
53+
54+
} ;
5055

5156
let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;
5257

53-
quicksort( compare.increasing , a , 0 , a.length ) ;
58+
fordjohnson( compare.increasing , a , 0 , a.length ) ;
5459

5560
a ; // [ 1 , 2 , 3 , 4 , 5 , 6 ]
5661

57-
quicksort( compare.decreasing , a , 0 , a.length ) ;
62+
fordjohnson( compare.decreasing , a , 0 , a.length ) ;
5863

5964
a ; // [ 6 , 5 , 4 , 3 , 2 , 1 ]
6065

6166
// but also
6267

63-
/** binary heapsort */
64-
let heapsort = sort.__heapsort__( 2 ) ;
65-
/** ternary heapsort */
66-
let heapsort = sort.__heapsort__( 3 ) ;
67-
/** quicksort (lomuto) */
68-
let quicksort = sort.__quicksort__( sort.lomuto ) ;
69-
/** dualpivotquicksort (yaroslavskiy) */
70-
let quicksort = sort.__dualpivotquicksort__( sort.yaroslavskiy ) ;
7168
/** insertionsort */
7269
let insertionsort = sort.insertionsort ;
7370
/** selectionsort */
@@ -78,5 +75,4 @@ let bubblesort = sort.bubblesort ;
7875

7976
## Reference
8077

81-
- https://kluedo.ub.uni-kl.de/frontdoor/index/index/docId/3463
8278
- http://sorting.at

0 commit comments

Comments
 (0)