Corrections

This commit is contained in:
Antti H S Laaksonen 2017-02-11 21:31:56 +02:00
parent 1f78835fd3
commit 32659fe3d2
1 changed files with 10 additions and 10 deletions

View File

@ -404,16 +404,16 @@ and the right endpoint moves two steps to the right.
After each step, we update the After each step, we update the
array \texttt{c}. array \texttt{c}.
If an element $x$ is added to the range, After adding an element $x$,
the value we increase the value of
$\texttt{c}[x]$ increases by one, $\texttt{c}[x]$ by one
and if an element $x$ is removed from the range, and if $\texttt{c}[x]=1$ after this,
the value $\texttt{c}[x]$ decreases by one. we also increase the answer to the query by one.
If after an insertion In a similar way, after removing an element $x$,
$\texttt{c}[x]=1$, we decrease the value of
the answer to the query will be increased by one, $\texttt{c}[x]$ by one
and if after a removal $\texttt{c}[x]=0$, and if $\texttt{c}[x]=0$ after this,
the answer to the query will be decreased by one. we also decrease the answer to the query by one.
In this problem, the time needed to perform In this problem, the time needed to perform
each step is $O(1)$, so the total time complexity each step is $O(1)$, so the total time complexity