Fix typos
This commit is contained in:
parent
8fd7c78022
commit
d80a5e7400
|
@ -496,7 +496,7 @@ go through all $O(n^2)$ pairs of rows and for each pair
|
||||||
$(a,b)$ calculate the number of columns that contain a black
|
$(a,b)$ calculate the number of columns that contain a black
|
||||||
square in both rows in $O(n)$ time.
|
square in both rows in $O(n)$ time.
|
||||||
The following code assumes that $\texttt{color}[y][x]$
|
The following code assumes that $\texttt{color}[y][x]$
|
||||||
denotes the color in row $y$ in column $x$:
|
denotes the color in row $y$ and column $x$:
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
|
@ -727,7 +727,7 @@ we declare an array
|
||||||
pair<int,int> best[1<<N];
|
pair<int,int> best[1<<N];
|
||||||
\end{lstlisting}
|
\end{lstlisting}
|
||||||
that contains for each subset $S$
|
that contains for each subset $S$
|
||||||
a pair $(\texttt{rides}(S),\texttt{last}(S)$.
|
a pair $(\texttt{rides}(S),\texttt{last}(S))$.
|
||||||
For an empty group, no rides are needed:
|
For an empty group, no rides are needed:
|
||||||
\begin{lstlisting}
|
\begin{lstlisting}
|
||||||
best[0] = {0,0};
|
best[0] = {0,0};
|
||||||
|
@ -763,7 +763,7 @@ correct order.
|
||||||
\subsubsection{Counting subsets}
|
\subsubsection{Counting subsets}
|
||||||
|
|
||||||
Our last problem in this chapter is as follows:
|
Our last problem in this chapter is as follows:
|
||||||
Let $X=\{0 \ldots n-1\}$, and each subset $S \subset X$,
|
Let $X=\{0 \ldots n-1\}$, and each subset $S \subset X$
|
||||||
is assigned an integer $\texttt{value}[S]$.
|
is assigned an integer $\texttt{value}[S]$.
|
||||||
Our task is to calculate for each $S$
|
Our task is to calculate for each $S$
|
||||||
\[\texttt{sum}(S) = \sum_{A \subset S} \texttt{value}[A],\]
|
\[\texttt{sum}(S) = \sum_{A \subset S} \texttt{value}[A],\]
|
||||||
|
|
Loading…
Reference in New Issue