<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
segment	B-Architecture
tree	I-Architecture
,	O
also	O
known	O
as	O
a	O
statistic	O
tree	B-Application
,	O
is	O
a	O
tree	B-Application
data	I-Application
structure	I-Application
used	O
for	O
storing	O
information	O
about	O
intervals	O
,	O
or	O
segments	O
.	O
</s>
<s>
A	O
similar	O
data	B-General_Concept
structure	I-General_Concept
is	O
the	O
interval	B-Data_Structure
tree	I-Data_Structure
.	O
</s>
<s>
A	O
segment	B-Architecture
tree	I-Architecture
for	O
a	O
set	O
of	O
n	O
intervals	O
uses	O
O(n log n )	O
storage	O
and	O
can	O
be	O
built	O
in	O
O(n log n )	O
time	O
.	O
</s>
<s>
Segment	B-Architecture
trees	I-Architecture
support	O
searching	O
for	O
all	O
the	O
intervals	O
that	O
contain	O
a	O
query	O
point	O
in	O
time	O
O( log	O
n	O
+	O
k	O
)	O
,	O
k	O
being	O
the	O
number	O
of	O
retrieved	O
intervals	O
or	O
segments	O
.	O
</s>
<s>
Applications	O
of	O
the	O
segment	B-Architecture
tree	I-Architecture
are	O
in	O
the	O
areas	O
of	O
computational	O
geometry	O
,	O
geographic	B-Application
information	I-Application
systems	I-Application
and	O
machine	O
learning	O
.	O
</s>
<s>
The	O
segment	B-Architecture
tree	I-Architecture
can	O
be	O
generalized	O
to	O
higher	O
dimension	O
spaces	O
.	O
</s>
<s>
Given	O
a	O
set	O
of	O
intervals	O
,	O
or	O
segments	O
,	O
a	O
segment	B-Architecture
tree	I-Architecture
T	O
for	O
is	O
structured	O
as	O
follows	O
:	O
</s>
<s>
T	O
is	O
a	O
binary	O
tree	B-Application
.	O
</s>
<s>
Its	O
leaves	B-Data_Structure
correspond	O
to	O
the	O
elementary	O
intervals	O
induced	O
by	O
the	O
endpoints	O
in	O
,	O
in	O
an	O
ordered	O
way	O
:	O
the	O
leftmost	O
leaf	O
corresponds	O
to	O
the	O
leftmost	O
interval	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
The	O
internal	O
nodes	O
of	O
T	O
correspond	O
to	O
intervals	O
that	O
are	O
the	O
union	O
of	O
elementary	O
intervals	O
:	O
the	O
interval	O
Int(N )	O
corresponding	O
to	O
node	O
N	O
is	O
the	O
union	O
of	O
the	O
intervals	O
corresponding	O
to	O
the	O
leaves	B-Data_Structure
of	O
the	O
tree	B-Application
rooted	O
at	O
N	O
.	O
That	O
implies	O
that	O
Int(N )	O
is	O
the	O
union	O
of	O
the	O
intervals	O
of	O
its	O
two	O
children	O
.	O
</s>
<s>
Each	O
node	O
or	O
leaf	O
v	O
in	O
T	O
stores	O
the	O
interval	O
Int(v )	O
and	O
a	O
set	O
of	O
intervals	O
,	O
in	O
some	O
data	B-General_Concept
structure	I-General_Concept
.	O
</s>
<s>
A	O
segment	B-Architecture
tree	I-Architecture
from	O
the	O
set	O
of	O
segments	O
,	O
can	O
be	O
built	O
as	O
follows	O
.	O
</s>
<s>
Then	O
,	O
a	O
balanced	O
binary	O
tree	B-Application
is	O
built	O
on	O
the	O
elementary	O
intervals	O
,	O
and	O
for	O
each	O
node	O
v	O
it	O
is	O
determined	O
the	O
interval	O
Int(v )	O
it	O
represents	O
.	O
</s>
<s>
To	O
achieve	O
this	O
,	O
the	O
intervals	O
in	O
are	O
inserted	O
one	O
by	O
one	O
into	O
the	O
segment	B-Architecture
tree	I-Architecture
.	O
</s>
<s>
An	O
interval	O
X	O
=	O
[	O
x	O
,	O
x′ ]	O
can	O
be	O
inserted	O
in	O
a	O
subtree	B-Application
rooted	O
at	O
T	O
,	O
using	O
the	O
following	O
procedure	O
:	O
</s>
<s>
A	O
query	O
for	O
a	O
segment	B-Architecture
tree	I-Architecture
receives	O
a	O
point	O
qx(should be one of the leaves of tree )	O
,	O
and	O
retrieves	O
a	O
list	O
of	O
all	O
the	O
segments	O
stored	O
which	O
contain	O
the	O
point	O
qx	O
.	O
</s>
<s>
Formally	O
stated	O
;	O
given	O
a	O
node	O
(	O
subtree	B-Application
)	O
v	O
and	O
a	O
query	O
point	O
qx	O
,	O
the	O
query	O
can	O
be	O
done	O
using	O
the	O
following	O
algorithm	O
:	O
</s>
<s>
In	O
a	O
segment	B-Architecture
tree	I-Architecture
that	O
contains	O
n	O
intervals	O
,	O
those	O
containing	O
a	O
given	O
query	O
point	O
can	O
be	O
reported	O
in	O
O( log	O
n	O
+	O
k	O
)	O
time	O
,	O
where	O
k	O
is	O
the	O
number	O
of	O
reported	O
intervals	O
.	O
</s>
<s>
A	O
segment	B-Architecture
tree	I-Architecture
T	O
on	O
a	O
set	O
of	O
n	O
intervals	O
uses	O
O(n log n )	O
storage	O
.	O
</s>
<s>
Because	O
T	O
is	O
a	O
binary	O
balanced	O
tree	B-Application
with	O
at	O
most	O
4n	O
+	O
1	O
leaves	B-Data_Structure
,	O
its	O
height	O
is	O
O(log n )	O
.	O
</s>
<s>
Since	O
any	O
interval	O
is	O
stored	O
at	O
most	O
twice	O
at	O
a	O
given	O
depth	O
of	O
the	O
tree	B-Application
,	O
that	O
the	O
total	O
amount	O
of	O
storage	O
is	O
O(n log n )	O
.	O
</s>
<s>
The	O
segment	B-Architecture
tree	I-Architecture
can	O
be	O
generalized	O
to	O
higher	O
dimension	O
spaces	O
,	O
in	O
the	O
form	O
of	O
multi-level	O
segment	B-Architecture
trees	I-Architecture
.	O
</s>
<s>
In	O
higher	O
dimensional	O
versions	O
,	O
the	O
segment	B-Architecture
tree	I-Architecture
stores	O
a	O
collection	O
of	O
axis-parallel	O
(	O
hyper	O
-	O
)	O
rectangles	O
,	O
and	O
can	O
retrieve	O
the	O
rectangles	O
that	O
contain	O
a	O
given	O
query	O
point	O
.	O
</s>
<s>
The	O
use	O
of	O
fractional	B-Data_Structure
cascading	I-Data_Structure
lowers	O
the	O
query	O
time	O
bound	O
by	O
a	O
logarithmic	O
factor	O
.	O
</s>
<s>
The	O
use	O
of	O
the	O
interval	B-Data_Structure
tree	I-Data_Structure
on	O
the	O
deepest	O
level	O
of	O
associated	O
structures	O
lowers	O
the	O
storage	O
bound	O
by	O
a	O
logarithmic	O
factor	O
.	O
</s>
