@@ -14,16 +14,23 @@ Sorting code bricks for JavaScript.
14
14
[ ![ NPM downloads per month] ( http://img.shields.io/npm/dm/aureooms-js-sort.svg?style=flat )] ( https://www.npmjs.org/package/aureooms-js-sort )
15
15
[ ![ GitHub issues] ( http://img.shields.io/github/issues/aureooms/js-sort.svg?style=flat )] ( https://github.com/aureooms/js-sort/issues )
16
16
17
+ Can be managed through [ bower] ( https://github.com/bower/bower ) ,
18
+ [ component] ( https://github.com/componentjs/component ) , or
19
+ [ npm] ( https://github.com/npm/npm ) .
20
+
21
+ ``` js
22
+ let sort = require ( " aureooms-js-sort" ) ;
23
+ ```
24
+
17
25
Example usage:
18
26
19
27
``` js
20
- compare = require ( " aureooms-js-compare" ) ;
21
- sort = require ( " aureooms-js-sort" ) ;
28
+ let compare = require ( " aureooms-js-compare" ) ;
22
29
23
30
/** quicksort using hoare partitioning */
24
- quicksort = sort .__quicksort__ ( sort .hoare ) ;
31
+ let quicksort = sort .__quicksort__ ( sort .hoare ) ;
25
32
26
- a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;
33
+ let a = [ 1 , 6 , 5 , 3 , 2 , 4 ] ;
27
34
28
35
quicksort ( compare .increasing , a , 0 , a .length ) ;
29
36
@@ -36,19 +43,19 @@ a ; // [ 6 , 5 , 4 , 3 , 2 , 1 ]
36
43
// but also
37
44
38
45
/** binary heapsort */
39
- heapsort = sort .__heapsort__ ( 2 ) ;
46
+ let heapsort = sort .__heapsort__ ( 2 ) ;
40
47
/** ternary heapsort */
41
- heapsort = sort .__heapsort__ ( 3 ) ;
48
+ let heapsort = sort .__heapsort__ ( 3 ) ;
42
49
/** quicksort (lomuto) */
43
- quicksort = sort .__quicksort__ ( sort .lomuto ) ;
50
+ let quicksort = sort .__quicksort__ ( sort .lomuto ) ;
44
51
/** dualpivotquicksort (yaroslavskiy) */
45
- quicksort = sort .__dualpivotquicksort__ ( sort .yaroslavskiy ) ;
52
+ let quicksort = sort .__dualpivotquicksort__ ( sort .yaroslavskiy ) ;
46
53
/** insertionsort */
47
- insertionsort = sort .insertionsort ;
54
+ let insertionsort = sort .insertionsort ;
48
55
/** selectionsort */
49
- selectionsort = sort .selectionsort ;
56
+ let selectionsort = sort .selectionsort ;
50
57
/** bubblesort */
51
- bubblesort = sort .bubblesort ;
58
+ let bubblesort = sort .bubblesort ;
52
59
```
53
60
54
61
Reference:
0 commit comments