# AvAlg HW2

$$2^{n+1}/2=2^{n}\\ \rightarrow\textrm{Two parts of size }2^{n}\\ \textrm{i.e.:}\\ 1.\{1,...,2^{n}\}\\ 2.\{2^{n}+1,...,2^{n+1}\}\\ \textrm{Shift the ranges one step down and we get:}\\ 1.\{0,...,2^{n}-1\}\\ 2.\{2^{n},...,2^{n+1}-1\}\\ \\$$

Actually, we can express Theorem 1.2 in terms of Theorem 1.1:

$$x_{1},y_{1}\textrm{from Theorem 1.1; }x_{2},y_{2}\textrm{ from Theorem 1.2}\ \\ x_{2},y_{2}\in\{2^{n},...2^{n+1}-1\}\textrm{ & }\ x_{1},y_{1}\in\{0,...,2^{n}-1\}\\ \rightarrow x_{2}=x_{1}+2^{n}\textrm{ & }\ y_{2}=y_{1}+2^{n}\\ \rightarrow x_{2}=y_{2}\rightarrow x_{1}+2^{n}=y_{1}+2^{n}\rightarrow\textrm{proceed to break out }2^{n}\textrm{ in the relation based on Theorem 1.1.}\\ \\$$

This also means that the range of possible values of the modulo operator in f will also range the same as in Theorem 1.1; which therefore follows (as multiplying by the argument of previously same range, results in a linear raise of the codomain) the codomain of f in Theorem 1.2.

We can therefore state that for Theorem 1.2 in relation to Theorem 1.1 that sense:

• The range for x and y is of the same size and the new range is still linear.
• Sense the range for x and y is of the same size and still linear, mod p will have the same codomain as in Theorem 1.1.
• The codomain of f is linearly transformed from Theorem 1.1 to 1.2 by the change in range for x and y.
• As we have shown that that instances of Theorem 1.2 can always be described as a instance of Theorem 1.1; 1.2 will inherent the properties of Theorem 1.1.
• As we are primarily concerned with the relationship between the values of x and y rather than their actual numerical, we can state that Theorem 1.2 must be true on the same basis of why Theorem 1.1 is true. Our expression of 1.2 doesn't affect that; hence Theorem 1.2 will have the same properties as Theorem 1.1.

$$f(x) = x\textrm{ }mod \textrm{ }{p}$$

## (D-level)

Consider the streaming algorithm for the 1-sparse recovery problem in a non-negative dynamic stream we discussed in class. Show that the same algorithm does not work for case of dynamic stream (give an explicit input stream where the algorithm does not work).
Remark: Recall that a stream is 1-sparse as long as 1 number remains, regardless of the sign. For example, stream (4,-) is 1-sparse. Stream (1, -), (1, -) is also 1-sparse.

Let's first define the terms of 1-sparse recovery as defined in the lectures and in DD2440 – Summary of algorithms by Arvid Fahlström Myrman:

• Given: m items
• For each item in the stream, calculate a bitsum according to the sign in the items.