data_structures_rmolinari 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/ext/cc.h +3879 -0
- data/ext/shared.h +33 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a41b03a0d46982d64fc1ec5648174df24c6c9b0593ff93354ad90fc65ff84e8e
|
4
|
+
data.tar.gz: 544aa69540c9cef54c4eb6402b260bafbbeddf7dc5e770bf428976c11161c58e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19efca577bb0c3c9524cf09b6f63c0e06beab70bfd20d1dbafa5034009be9bcb965ac5b8cee0ba0a39ecdcb646c401a54b363852a4572613941f7a34da174593
|
7
|
+
data.tar.gz: 05606e9c142a9bcb69a9fd555586b0ad8fe76bf7572af3dd82003de673d78b671b9a5edf1e5d4a2e4c7d5c6d5e41bef2ed1679573600725b74a25d4f3665c6ee
|
data/README.md
CHANGED
@@ -9,6 +9,8 @@ as fast as possible.
|
|
9
9
|
|
10
10
|
The code is available as a gem: https://rubygems.org/gems/data_structures_rmolinari.
|
11
11
|
|
12
|
+
It is distributed under the MIT license.
|
13
|
+
|
12
14
|
## Usage
|
13
15
|
|
14
16
|
The right way to organize the code is not obvious to me. For now the data structures are all defined in the module
|
@@ -166,13 +168,13 @@ SegmentTree = DataStructuresRMolinari::SegmentTree # namespace module
|
|
166
168
|
|
167
169
|
data = [1, -3, 2, 1, 5, -9]
|
168
170
|
|
169
|
-
# Get a segment tree instance that will answer "max over this subinterval" questions about data.
|
171
|
+
# Get a segment tree instance that will answer "max over this subinterval?" questions about data.
|
170
172
|
# Here we get one using the ruby implementation of the generic functionality.
|
171
173
|
#
|
172
|
-
#
|
173
|
-
#
|
174
|
+
# Put :index_of_max in place of :map to get an instance that returns "an index of the maximum value
|
175
|
+
# over this subinterval".
|
174
176
|
#
|
175
|
-
# To use the
|
177
|
+
# To use the generic code written in C, put :c instead of :ruby.
|
176
178
|
seg_tree = SegmentTree.construct(data, :max, :ruby)
|
177
179
|
|
178
180
|
seg_tree.max_on(0, 2) # => 2
|