Questions tagged [range-map]
7 questions
30
votes
8 answers
Data structures that can map a range of keys to a value
I am trying to find a data structure that takes in a particular value from a range of values and map it to a key.
For example, I have the following conditions:
From 1 to 2.9, I want to map it to A.
From 4 to 6, I want to map it to B.
From 6.5 to…

Sakura
- 869
- 4
- 13
- 32
22
votes
6 answers
Get values for keys within a range in Java
Suppose I have a map in Java which looks like this:
{
39:"39 to 41",
41:"41 to 43",
43:"43 to 45",
45:">=45"
}
If the keys are in sorted order(either using treemap or linkedhashmap).Now if i try to get a value which is >=39 and <41.Then I…

Emil
- 13,577
- 18
- 69
- 108
18
votes
1 answer
Scala range / interval map structure
I have almost the same question as mentioned in Data structures that can map a range of keys to a value, but for Scala.
That is, I'd like to have a mutable system of non-overlapping 1D ranges [a[i], b[i]) that would map to some sort of value v[i]. A…

GreyCat
- 16,622
- 18
- 74
- 112
2
votes
0 answers
guava RangeMap ranges mapped to multiple values
I'm trying to find a data structure such that I will get this:
[1, 100) -> A
merge with
[2, 50) -> B
will become like this:
[1, 2) -> A,
[2, 50) -> A,B
[50, 100) -> b
I'm using RangeMap and I want to merge ranges like in the example but it didn't…

Omri
- 31
- 2
0
votes
1 answer
Range mapping in Python
MAPPER DATAFRAME
col_data = {'p0_tsize_qbin_':[1, 2, 3, 4, 5] ,
'p0_tsize_min':[0.0, 7.0499999999999545, 16.149999999999977, 32.65000000000009, 76.79999999999973] ,
'p0_tsize_max':[7.0, 16.100000000000023, 32.64999999999998,…

Nabi Shaikh
- 787
- 1
- 6
- 26
0
votes
0 answers
Could Guava RangeMap be serialized and deserialized efficiently?
I have an use-case where a guava RangeMap needs to pre-built and loaded into redis. At some point in the future, it would be retrieved from redis and used again.
This is done to reduce the time in building the rangeMap itself.
Any suggestions or…

Ullas Kashyap
- 55
- 4
-1
votes
1 answer
How do I map every element in a range with a function?
I see that I can define a range with 1:3. I can also apply a function to a number, e.g. sin(1). But, how do I map the range of numbers with the function? I would like to $1,2,3 \to sin(1), sin(2), sin(3)$.

Valentin Tihomirov
- 1
- 1
- 6
- 28