From 32659fe3d2a3c2426ee9cd5443dc7a63889d5104 Mon Sep 17 00:00:00 2001 From: Antti H S Laaksonen Date: Sat, 11 Feb 2017 21:31:56 +0200 Subject: [PATCH] Corrections --- luku27.tex | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/luku27.tex b/luku27.tex index 65050b5..d422c0f 100644 --- a/luku27.tex +++ b/luku27.tex @@ -404,16 +404,16 @@ and the right endpoint moves two steps to the right. After each step, we update the array \texttt{c}. -If an element $x$ is added to the range, -the value -$\texttt{c}[x]$ increases by one, -and if an element $x$ is removed from the range, -the value $\texttt{c}[x]$ decreases by one. -If after an insertion -$\texttt{c}[x]=1$, -the answer to the query will be increased by one, -and if after a removal $\texttt{c}[x]=0$, -the answer to the query will be decreased by one. +After adding an element $x$, +we increase the value of +$\texttt{c}[x]$ by one +and if $\texttt{c}[x]=1$ after this, +we also increase the answer to the query by one. +In a similar way, after removing an element $x$, +we decrease the value of +$\texttt{c}[x]$ by one +and if $\texttt{c}[x]=0$ after this, +we also decrease the answer to the query by one. In this problem, the time needed to perform each step is $O(1)$, so the total time complexity