Small fixes

This commit is contained in:
Antti H S Laaksonen 2017-05-07 00:49:58 +03:00
parent c1154d9147
commit af228c7e46
1 changed files with 9 additions and 9 deletions

View File

@ -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$.