Skip to main content

Questions tagged [range-query]

2 votes
0 answers
51 views

I have a long array of size $n>10^6$, call it $X$. I would like to find all ranges $[a, b)$ satisfying the following conditions $\sum_{i=a}^{b-1}X[i] \leq 0$, $b-a \geq K$, $\sum_{i=a-1}^{b-1} X[i]...
cebir latis's user avatar
2 votes
1 answer
51 views

Given segment $\left[L, R\right]$ check if there is an inversion in the segment. If $a_i > a_j$ and $j> i$ then it is an inversion. Can this done faster than a linear check given that we can ...
Itoshi Sae's user avatar
1 vote
1 answer
73 views

Given a list of ranges each with an associated value, the metric at a point is the sum of the values of all overlapping ranges. The goal is to produce a list of non-overlapping ranges that preserve ...
O'Schell's user avatar
1 vote
1 answer
102 views

Here is a data structure question in the comparison model that I can't answer. I have an array $A$ of $n$ elements. I work in the comparison model, meaning that the elements can only be compared with ...
Vasek's user avatar
  • 11
7 votes
2 answers
502 views

Suppose we have $N$ points on $XY$ plane, ie. $(x, y)$ and $x, y \in Z$ and multiple queries where each query is of the form $y = mx + c$ and $m, c \in Z$. Is it possible to count number of points ...
bihariforces's user avatar
0 votes
0 answers
98 views

I have a large array of bits of length $N$. The query $f(k, m)$ means "find $kth$ zero in the array and the next $m-1$ zeros after it", $k \in [0, N-1], m \ll N$ Currently I use a segment ...
Andrey Godyaev's user avatar
1 vote
2 answers
206 views

I am writing a UI that needs to display a chat log, similar to Slack and Discord. In addition to being able to scroll and lazy-fetch additional pages in either direction, I need to be able to jump to ...
chrylis -cautiouslyoptimistic-'s user avatar
0 votes
0 answers
59 views

If we have input of size $N=13$, which represents array that has 13 element. We need in general $O(N\log{N})$ memory to store all intervals. We see that number of intervals we need in terms of power ...
Avv's user avatar
  • 553
4 votes
1 answer
7k views

I have a range-query problem to solve. This problem requires not only range queries and update, but also insert or delete an element of the array. There is a series of operations that must be done in ...
matheuscscp's user avatar