1. 1. a 2. c 3. 4. b 5. d 6. e 2. 1. True 2. True 3. False, Example: Let $b$ be the problem if an algorithm terminates. This is undecidable (Alan Turing showed this). However we can also look at a subset of algorithms. We can look at all the algorithms that have finite length and contain no loops. We know that all these algorithms terminate, hence it is decidable. Let $A$ be this problem. We see that we can reduce $A$ to $B$, hence we have a counterexample. 4. True 3. 1. Can the items fit in a square of size $k\times k$. 2. **NP:** We will see the bottom-left corner of our square as the origin. As our certificate we will define $x_i,y_i$ as the x and y position of the bottom left corner of rectangle $i$. We have to check if to check if every rectangle fits inside of the square, so $0\leq x_i\leq k-w_i\land 0\leq y_i \leq k-h_i$ for all $i$. This takes $o(n)$ time. Then we need to check if none of the rectangles overlap, so $x_i+w_i\leq x_j \lor x_j +w_j\leq x_i \lor y_i+h_i\leq y_j \lor y_j+h_j\leq y_i$ for all $i\neq j$, hence this takes $o(n^2)$ time. We see that we can verify the certificate in polynomial time, hence it NP. **NP-Hard:** For this we need to reduce a problem we know is NP-Hard to this problem. My idea is to use the bin-packing problem from question 1. We transform it to an instance of SquareFinding as follows: - $n$ remains the same - The new $k'$ becomes $B\cdot k$. - $w_i = a_i\cdot k$ for all $i$ - $h_i=B$ for all $i$ We see that is process takes linear time. First assume that SquareFinding returns a true. We will show that BinPacking would also have had returned a True. Now let $x_i,y_i$ be the positions of the left bottom corner of the rectangles. We want the rectangles to be aligned such that $y_i = l*B$ for some integer $1\leq l\leq k$. If the are not aligned this way we can simply add $y_i$ downwards until it is aligned, together with all the blocks it might overlap on the way. For every $l$ we define $\text{contentsBin}_l = \{i\mid y_i=l\cdot B\}$. We see that $$\sum_{i\in\text{contentsBin}_{l}}a_i = \frac{1}{k}\sum_{i\mid y_{i}=l\cdot B} w_{i}\leq \frac{k'}{k}=B$$. Hence we have divided the items into $k$ sets with each a sum less or equal to $B$. Now assume that BinPacking returns a true. Meaning that for every $1\leq l\leq k$ there is a set $\text{contentsBin}_l\subset \{1,\dots,n\}$ such that $\sum_{i\in \text{contentsBin}_l}a_{i}\leq B$. Now we will say that if $i\in \text{contentsBin}_l$ that $y_i=l\cdot B$. We see that if $y_i\neq y_j$ that they will not overlap on the y-axis because both have height $B$. We also see that $$\sum_{i\mid y_{i}=l\cdot B} w_{i} = \sum_{i\in \text{contentsBin}_l}w_i = k\cdot \sum_{i\in \text{contentsBin}_l}a_i \leq k\cdot B = k'$$, hence everything fits in the square, hence SquareFinding gives a True 4. 1. Is there a subset $E'\subset E$ of size less than $k$ that connects all terminals $T$. 2. **NP:** As the certificate we use the set $E'$. To check if this is correct we need to perform $DFS$ on a $t\in T$ using the edges in $E'$. And that every element of $T$ is reached. Also we need to check that $E'$ does not contain more than $k$ elements. **NP-Hard:** For this we need to reduce VertexCover to SteinerTree. This is very simple: - Choose $T=V$ - Keep $(V,E)$ and $k$ the same the same First assume that VertexCover returns true. Meaning that there exists a $E'\subset E$ such that all vertices $V$ are conncected, hence all $T$ are connectected hence SteinerTree also returns true. Now assume that SteinerTree returns true. Meaning that there exists a $E'\subset E$ such that all vertices $T$ are conncected, hence all $V$ are connectected hence VertexCover also returns true.