1
1
[ js-binomial-heap] ( http://aureooms.github.io/js-binomial-heap )
2
2
==
3
3
4
- Binomial heap code bricks in JavaScript. Parent is
5
- [ aureooms/js-heap] ( https://github.com/aureooms/js-heap ) .
4
+ Binomial heap data structures for JavaScript.
5
+ Parent is [ aureooms/js-heap] ( https://github.com/aureooms/js-heap ) .
6
6
7
7
``` js
8
8
//
@@ -18,160 +18,15 @@ Binomial heap code bricks in JavaScript. Parent is
18
18
19
19
[ ![ NPM license] ( http://img.shields.io/npm/l/aureooms-js-binomial-heap.svg?style=flat )] ( https://raw.githubusercontent.com/aureooms/js-binomial-heap/master/LICENSE )
20
20
[ ![ NPM version] ( http://img.shields.io/npm/v/aureooms-js-binomial-heap.svg?style=flat )] ( https://www.npmjs.org/package/aureooms-js-binomial-heap )
21
- [ ![ Bower version] ( http://img.shields.io/bower/v/aureooms-js-binomial-heap.svg?style=flat )] ( http://bower.io/search/?q=aureooms-js-binomial-heap )
22
21
[ ![ Build Status] ( http://img.shields.io/travis/aureooms/js-binomial-heap.svg?style=flat )] ( https://travis-ci.org/aureooms/js-binomial-heap )
23
22
[ ![ Coverage Status] ( http://img.shields.io/coveralls/aureooms/js-binomial-heap.svg?style=flat )] ( https://coveralls.io/r/aureooms/js-binomial-heap )
24
23
[ ![ Dependencies Status] ( http://img.shields.io/david/aureooms/js-binomial-heap.svg?style=flat )] ( https://david-dm.org/aureooms/js-binomial-heap#info=dependencies )
25
24
[ ![ devDependencies Status] ( http://img.shields.io/david/dev/aureooms/js-binomial-heap.svg?style=flat )] ( https://david-dm.org/aureooms/js-binomial-heap#info=devDependencies )
26
25
[ ![ Code Climate] ( http://img.shields.io/codeclimate/github/aureooms/js-binomial-heap.svg?style=flat )] ( https://codeclimate.com/github/aureooms/js-binomial-heap )
27
26
[ ![ NPM downloads per month] ( http://img.shields.io/npm/dm/aureooms-js-binomial-heap.svg?style=flat )] ( https://www.npmjs.org/package/aureooms-js-binomial-heap )
28
27
[ ![ GitHub issues] ( http://img.shields.io/github/issues/aureooms/js-binomial-heap.svg?style=flat )] ( https://github.com/aureooms/js-binomial-heap/issues )
29
- [ ![ Inline docs] ( http://inch-ci.org/github/aureooms/js-binomial-heap.svg?branch=master&style=shields )] ( http://inch-ci.org/github/aureooms/js-binomial-heap )
30
-
31
- Can be managed through [ jspm] ( https://github.com/jspm/jspm-cli ) ,
32
- [ duo] ( https://github.com/duojs/duo ) ,
33
- [ component] ( https://github.com/componentjs/component ) ,
34
- [ bower] ( https://github.com/bower/bower ) ,
35
- [ ender] ( https://github.com/ender-js/Ender ) ,
36
- [ jam] ( https://github.com/caolan/jam ) ,
37
- [ spm] ( https://github.com/spmjs/spm ) ,
38
- and [ npm] ( https://github.com/npm/npm ) .
39
-
40
- ## Description
41
-
42
- This package contains binomial heap implementations.
43
-
44
-
45
- ## Install
46
-
47
- ### jspm
48
- ``` terminal
49
- jspm install github:aureooms/js-binomial-heap
50
- # or
51
- jspm install npm:aureooms-js-binomial-heap
52
- ```
53
- ### duo
54
- No install step needed for duo!
55
-
56
- ### component
57
- ``` terminal
58
- component install aureooms/js-binomial-heap
59
- ```
60
-
61
- ### bower
62
- ``` terminal
63
- bower install aureooms-js-binomial-heap
64
- ```
65
-
66
- ### ender
67
- ``` terminal
68
- ender add aureooms-js-binomial-heap
69
- ```
70
-
71
- ### jam
72
- ``` terminal
73
- jam install aureooms-js-binomial-heap
74
- ```
75
-
76
- ### spm
77
- ``` terminal
78
- spm install aureooms-js-binomial-heap --save
79
- ```
80
-
81
- ### npm
82
- ``` terminal
83
- npm install aureooms-js-binomial-heap --save
84
- ```
85
-
86
- ## Require
87
- ### jspm
88
- ``` js
89
- let binomialheap = require ( " github:aureooms/js-binomial-heap" ) ;
90
- // or
91
- import binomialheap from ' aureooms-js-binomial-heap' ;
92
- ```
93
- ### duo
94
- ``` js
95
- let binomialheap = require ( " aureooms/js-binomial-heap" ) ;
96
- ```
97
-
98
- ### component, ender, spm, npm
99
- ``` js
100
- let binomialheap = require ( " aureooms-js-binomial-heap" ) ;
101
- ```
102
-
103
- ### bower
104
- The script tag exposes the global variable ` binomialheap ` .
105
- ``` html
106
- <script src =" bower_components/aureooms-js-binomial-heap/js/dist/binomial-heap.min.js" ></script >
107
- ```
108
- Alternatively, you can use any tool mentioned [ here] ( http://bower.io/docs/tools/ ) .
109
-
110
- ### jam
111
- ``` js
112
- require ( [ " aureooms-js-binomial-heap" ] , function ( binomialheap ) { ... } ) ;
113
- ```
114
-
115
- ## Use
116
-
117
- ``` js
118
- // can choose between 3 different implementations
119
- //
120
- // - BinomialHeap( BinomialTreeWithParent )
121
- // # head -> value
122
- // # headreference -> reference
123
- // # pop -> value
124
- // # popreference -> reference
125
- // # push( value ) -> reference
126
- // # pushreference( reference )
127
- // # merge( other )
128
- // # update( reference , value )
129
- // # decreasekey( reference , value )
130
- // # increasekey( reference , value )
131
- // # delete( reference )
132
- //
133
- // - BinomialHeap( BinomialTree )
134
- // # head -> value
135
- // # pop -> value
136
- // # push( value )
137
- // # merge( other )
138
- //
139
- // - LazyBinomialHeap( BinomialTree )
140
- // # pop -> value
141
- // # push( value )
142
- // # merge( other )
143
-
144
- let compare = require ( " aureooms-js-compare" ) ;
145
-
146
- let Heap = binomialheap. ... ( binomialheap. ... ) ;
147
-
148
- let a = new Heap ( compare .increasing ) ;
149
- let b = new Heap ( compare .increasing ) ;
150
-
151
- a .push ( 5 ) ;
152
- a .push ( 1 ) ;
153
- a .push ( 4 ) ;
154
- b .push ( 3 ) ;
155
- b .push ( 2 ) ;
156
-
157
- a .length ; // 3
158
- b .length ; // 2
159
-
160
- a .merge ( b ) ;
161
- delete b ;
162
-
163
- a .length ; // 5
164
-
165
- a .pop ( ) ; // 1
166
- a .pop ( ) ; // 2
167
- a .pop ( ) ; // 3
168
- a .pop ( ) ; // 4
169
- a .pop ( ) ; // 5
170
-
171
- a .length ; // 0
172
- ```
28
+ [ ![ Documentation] ( https://aureooms.github.io/js-binomial-heap/badge.svg )] ( https://aureooms.github.io/js-binomial-heap/source.html )
173
29
174
30
## Reference
175
31
176
32
- http://www.cs.princeton.edu/~wayne/cs423/lectures/heaps-4up.pdf
177
-
0 commit comments