Small fixes
This commit is contained in:
parent
c1154d9147
commit
af228c7e46
|
@ -931,24 +931,24 @@ $3+4-2\cdot2=3$.
|
||||||
\section{Offline algorithms}
|
\section{Offline algorithms}
|
||||||
|
|
||||||
So far, we have discussed \emph{online} algorithms
|
So far, we have discussed \emph{online} algorithms
|
||||||
that are able to efficiently process queries
|
for tree queries.
|
||||||
one after another in a given order.
|
Those algorithms are able to process
|
||||||
In particular, we may require that the algorithm
|
queries one after another so that
|
||||||
processes each query before receiving the next query.
|
each query is answered before receiving the next query.
|
||||||
|
|
||||||
However, in many problems, the online
|
However, in many problems, the online
|
||||||
property is not necessary.
|
property is not necessary.
|
||||||
In this section, we focus on \emph{offline} algorithms
|
In this section, we focus on \emph{offline} algorithms.
|
||||||
that are given a set of queries that can be
|
Those algorithms are given a set of queries which can
|
||||||
processed in any order.
|
be answered in any order.
|
||||||
It is often easier to design an offline algorithm
|
It is often easier to design an offline algorithm
|
||||||
compared to an online algorithm.
|
compared to an online algorithm.
|
||||||
|
|
||||||
\subsubsection{Merging data structures}
|
\subsubsection{Merging data structures}
|
||||||
|
|
||||||
One method to construct an offline algorithm
|
One method to construct an offline algorithm
|
||||||
is to traverse the tree recursively
|
is to perform a depth-first tree traversal
|
||||||
and maintain data structures for processing queries.
|
and maintain data structures in nodes.
|
||||||
At each node $s$, we create a data structure
|
At each node $s$, we create a data structure
|
||||||
$\texttt{d}[s]$ that is based on the
|
$\texttt{d}[s]$ that is based on the
|
||||||
data structures of the children of $s$.
|
data structures of the children of $s$.
|
||||||
|
|
Loading…
Reference in New Issue