ruby_collections 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -3
- data/lib/ruby_collections/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 711f86e8d08effa34645af0d1f43560623b7e7ce
|
4
|
+
data.tar.gz: 017ef4bd0f90379add0bd4653751206eac952ba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1dcf3c5db4301b54cac67e4f17f179ca7b2e86db7fd53ed2dddea504355751e21e79e683a3f4232d752f60086aa22462962baa1358fbd9f7c9427c399dc805a
|
7
|
+
data.tar.gz: e01f04a2860777d3fe4713cacaca963097de07e7c39e503c18bda965b5c8a5974652c58bb695578ccfccb9dee4218be315a6cc4860efe904df33e5c6326cd286
|
data/README.md
CHANGED
@@ -22,6 +22,10 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
Supported Data Structures: Max Heap, Min Heap
|
24
24
|
|
25
|
+
### RubyCollections::MaxHeap
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
|
25
29
|
max_heap = RubyCollections::MaxHeap.new
|
26
30
|
|
27
31
|
max_heap.insert(1)
|
@@ -30,11 +34,13 @@ max_heap.insert(4)
|
|
30
34
|
|
31
35
|
max_heap.heap # => [nil, 1, 4]
|
32
36
|
|
33
|
-
max_heap.
|
37
|
+
max_heap.max # => 4
|
34
38
|
|
35
|
-
max_heap.
|
39
|
+
max_heap.extract_max # => 4
|
36
40
|
|
37
|
-
max_heap.
|
41
|
+
max_heap.max # => 1
|
42
|
+
|
43
|
+
```
|
38
44
|
|
39
45
|
Similarly we can use MinHeap as well.
|
40
46
|
|