<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
a	O
search	B-Data_Structure
tree	I-Data_Structure
is	O
a	O
tree	B-Application
data	I-Application
structure	I-Application
used	O
for	O
locating	O
specific	O
keys	O
from	O
within	O
a	O
set	O
.	O
</s>
<s>
In	O
order	O
for	O
a	O
tree	B-Application
to	O
function	O
as	O
a	O
search	B-Data_Structure
tree	I-Data_Structure
,	O
the	O
key	O
for	O
each	O
node	O
must	O
be	O
greater	O
than	O
any	O
keys	O
in	O
subtrees	B-Application
on	O
the	O
left	O
,	O
and	O
less	O
than	O
any	O
keys	O
in	O
subtrees	B-Application
on	O
the	O
right	O
.	O
</s>
<s>
The	O
advantage	O
of	O
search	B-Data_Structure
trees	I-Data_Structure
is	O
their	O
efficient	O
search	O
time	O
given	O
the	O
tree	B-Application
is	O
reasonably	O
balanced	O
,	O
which	O
is	O
to	O
say	O
the	O
leaves	O
at	O
either	O
end	O
are	O
of	O
comparable	O
depths	O
.	O
</s>
<s>
Various	O
search-tree	O
data	O
structures	O
exist	O
,	O
several	O
of	O
which	O
also	O
allow	O
efficient	O
insertion	O
and	O
deletion	O
of	O
elements	O
,	O
which	O
operations	O
then	O
have	O
to	O
maintain	O
tree	B-Application
balance	O
.	O
</s>
<s>
Search	B-Data_Structure
trees	I-Data_Structure
are	O
often	O
used	O
to	O
implement	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
The	O
search	B-Data_Structure
tree	I-Data_Structure
algorithm	O
uses	O
the	O
key	O
from	O
the	O
key	B-Application
–	I-Application
value	I-Application
pair	I-Application
to	O
find	O
a	O
location	O
,	O
and	O
then	O
the	O
application	O
stores	O
the	O
entire	O
key	B-Application
–	I-Application
value	I-Application
pair	I-Application
at	O
that	O
particular	O
location	O
.	O
</s>
<s>
A	O
Binary	O
Search	B-Data_Structure
Tree	I-Data_Structure
is	O
a	O
node-based	O
data	O
structure	O
where	O
each	O
node	O
contains	O
a	O
key	O
and	O
two	O
subtrees	B-Application
,	O
the	O
left	O
and	O
right	O
.	O
</s>
<s>
For	O
all	O
nodes	O
,	O
the	O
left	O
subtree	B-Application
's	O
key	O
must	O
be	O
less	O
than	O
the	O
node	O
's	O
key	O
,	O
and	O
the	O
right	O
subtree	B-Application
's	O
key	O
must	O
be	O
greater	O
than	O
the	O
node	O
's	O
key	O
.	O
</s>
<s>
These	O
subtrees	B-Application
must	O
all	O
qualify	O
as	O
binary	O
search	B-Data_Structure
trees	I-Data_Structure
.	O
</s>
<s>
The	O
worst-case	O
time	O
complexity	O
for	O
searching	O
a	O
binary	O
search	B-Data_Structure
tree	I-Data_Structure
is	O
the	O
height	O
of	O
the	O
tree	B-Application
,	O
which	O
can	O
be	O
as	O
small	O
as	O
O(log n )	O
for	O
a	O
tree	B-Application
with	O
n	O
elements	O
.	O
</s>
<s>
B-trees	O
are	O
generalizations	O
of	O
binary	O
search	B-Data_Structure
trees	I-Data_Structure
in	O
that	O
they	O
can	O
have	O
a	O
variable	O
number	O
of	O
subtrees	B-Application
at	O
each	O
node	O
.	O
</s>
<s>
The	O
advantage	O
is	O
that	O
B-trees	O
do	O
not	O
need	O
to	O
be	O
re-balanced	O
as	O
frequently	O
as	O
other	O
self-balancing	B-Data_Structure
trees	I-Data_Structure
.	O
</s>
<s>
The	O
time	O
complexity	O
for	O
searching	O
a	O
B-tree	O
is	O
O(log n )	O
.	O
</s>
<s>
An	O
(	O
a	O
,	O
b	O
)	O
-tree	O
is	O
a	O
search	B-Data_Structure
tree	I-Data_Structure
where	O
all	O
of	O
its	O
leaves	O
are	O
the	O
same	O
depth	O
.	O
</s>
<s>
The	O
time	O
complexity	O
for	O
searching	O
an	O
(	O
a	O
,	O
b	O
)	O
-tree	O
is	O
O(log n )	O
.	O
</s>
<s>
A	O
ternary	O
search	B-Data_Structure
tree	I-Data_Structure
is	O
a	O
type	O
of	O
tree	B-Application
that	O
can	O
have	O
3	O
nodes	O
:	O
a	O
low	O
child	O
,	O
an	O
equal	O
child	O
,	O
and	O
a	O
high	O
child	O
.	O
</s>
<s>
Each	O
node	O
stores	O
a	O
single	O
character	O
and	O
the	O
tree	B-Application
itself	O
is	O
ordered	O
the	O
same	O
way	O
a	O
binary	O
search	B-Data_Structure
tree	I-Data_Structure
is	O
,	O
with	O
the	O
exception	O
of	O
a	O
possible	O
third	O
node	O
.	O
</s>
<s>
Searching	O
a	O
ternary	O
search	B-Data_Structure
tree	I-Data_Structure
involves	O
passing	O
in	O
a	O
string	O
to	O
test	O
whether	O
any	O
path	O
contains	O
it	O
.	O
</s>
<s>
The	O
time	O
complexity	O
for	O
searching	O
a	O
balanced	O
ternary	O
search	B-Data_Structure
tree	I-Data_Structure
is	O
O(log n )	O
.	O
</s>
<s>
Assuming	O
the	O
tree	B-Application
is	O
ordered	O
,	O
we	O
can	O
take	O
a	O
key	O
and	O
attempt	O
to	O
locate	O
it	O
within	O
the	O
tree	B-Application
.	O
</s>
<s>
The	O
following	O
algorithms	O
are	O
generalized	O
for	O
binary	O
search	B-Data_Structure
trees	I-Data_Structure
,	O
but	O
the	O
same	O
idea	O
can	O
be	O
applied	O
to	O
trees	O
of	O
other	O
formats	O
.	O
</s>
<s>
In	O
a	O
sorted	O
tree	B-Application
,	O
the	O
minimum	O
is	O
located	O
at	O
the	O
node	O
farthest	O
left	O
,	O
while	O
the	O
maximum	O
is	O
located	O
at	O
the	O
node	O
farthest	O
right	O
.	O
</s>
