Questions tagged [intervals]
127 questions
13
votes
2 answers
Time Complexity proof for Segment Tree implementation of the ranged sum problem
I understand that segment trees can be used to find the sum of sub array of $A$. And that this can done in $\mathcal{O}(\log n)$ time according to the tutorial here.
However I'm not able to prove that the querying time is indeed $\mathcal{O}(\log…
Arijit Choudhury
- 131
- 1
- 4
11
votes
1 answer
Data structure for map on intervals
Let $n$ be an integer, and let $\mathbb{Z}$ denote the set of all integers. Let $[a,b]$ denote the interval of integers $\{a,a+1,a+2,\dots,b\}$.
I am looking for a data structure to represent a map $f:[1,n] \to \mathbb{Z}$. I want the data…
D.W.
- 167,959
- 22
- 232
- 500
10
votes
1 answer
2D interval scheduling problem
Suppose I give you $n$ axis-aligned rectangles with a specified width, height, and x-position (of the left edge) $\{(w_i, h_i, x_i) \mid i \in \{0, \ldots, n - 1\}\}$, as well as a bound $(y_\mathrm{min}, y_\mathrm{max})$ on the valid y-positions.…
taktoa
- 384
- 1
- 16
9
votes
1 answer
Optimality of DSATUR on interval graphs
The DSATUR algorithm is a greedy graph coloring algorithm. It consists of applying the usual greedy coloring algorithm, considering vertices in reverse lexicographic order of (number of different colors among neighbours, total number of…
Nathaniel
- 18,309
- 2
- 30
- 58
8
votes
0 answers
Find set of points with maximum distance inside given intervals?
Let $A$ be a set of $n$ closed intervals, $I_i$, with both extremes positive integers. Is there an efficient algorithm to find a set of $n$ points $P_i$, with $P_i \in I_i$, such that the minimum distance between all pairs of points is…
a06e
- 219
- 1
- 5
8
votes
2 answers
Algorithm to return largest subset of non-intersecting intervals
I need an efficient algorithm that takes input a collection of intervals and outputs the largest subset of non-intersecting intervals.
i.e. Given a set of intervals $I = \{I_1, I_2, \ldots, I_n\}$ of the real line, we need to output a set of…
user2112791
7
votes
2 answers
Choose non-adjacent numbers from intervals
Given a list of intervals with integral endpoints, we want to find out if we can choose one integer from each interval so that no two chosen numbers are adjacent. Can we do this in polynomial time?
My attempt is the following greedy strategy: Sort…
simmons
- 131
- 4
7
votes
0 answers
Finding a rainbow independent set in a circle
Inside the interval $[0,1]$, there are $n^2$ intervals of $n$ different colors: $n$ intervals of each color. The intervals of each color are pairwise-disjoint. A rainbow independent set is a set of $n$ pairwise-disjoint intervals, one of each…
Erel Segal-Halevi
- 6,088
- 1
- 25
- 60
6
votes
2 answers
Algorithm: ordering non-overlapping intervals
Assume we have a (multi)set of nontrivial intervals $\mathcal{I} = \{I_1,...,I_n\}$ and for any two $I_i, I_j \in \mathcal{I}$, we have that $I_i \cap I_j$ is trivial (that is: contains at most one point), or one of them contains the other. Just to…
G. Bach
- 2,019
- 1
- 17
- 27
5
votes
3 answers
How many range are completely inside a given range
I have a list of ranges ai , bi. And I have many queries in the form of a range c, d, which asks how many ranges ( ai, bi ) are completely inside c, d.
c <= ai & bi <= d
There are so many of these queries. So I want to know if there is an…
Saeid
- 349
- 3
- 15
5
votes
1 answer
Maximum interval scheduling - Circular Variation
Consider a variant of interval scheduling except now the intervals are arcs on a circle. The goal is to find the maximum number of arcs that do not overlap. Let $C$ be the circle
on the plane centered at the origin with unit radius. Let $A_1, ...,…
AspiringMat
- 623
- 5
- 19
4
votes
0 answers
Compile-time error control vs. interval arithmetic?
I use interval arithmetic for reliable computing. Now, a procedure coded in a good implementation of interval arithmetic takes perhaps about eight times as much as the same procedure carried out without interval arithmetic (if the lion's share of…
H A Helfgott
- 241
- 1
- 6
4
votes
0 answers
Construct polygons from axis-aligned intervals
Scenario
Consider one or more curved shapes in 2D space, clipped to a rectangular viewport. For example:
Unfortunately, data that would describe these shapes precisely, is not available.
Input data
All that is available are the intersections of the…
smls
- 173
- 4
4
votes
2 answers
Find all intervals that are contained in a query interval
Given a set of intervals $S = I_1, ..., I_n$, what is the fastest way to find all intervals of $S$ that are completely contained in an interval $I_\text{query}$? It should also support incremental (dynamic) insertion of new intervals to…
plasmacel
- 207
- 2
- 11
4
votes
1 answer
Are IEEE floating point numbers intervals or point values?
The context is IEEE 754-2008 floating point number systems. The systems defined by the standard comprise, as far as I understand it, a bit-level representation and a set of guarantees on the precision for a given number of computations.
Now, I am…
equaeghe
- 200
- 1
- 8