Are these problems NP-Complete? I got 2 decision problem that I need to answer if they are in P or they are NP complete:


  1.Just like subset sum:
  given the integers or natural numbers ${\displaystyle w_{1},\ldots ,w_{n}}$ does any subset of them sum to precisely ${\displaystyle W}$?


but now instead of $W$: 


  does any subset of them sum to $W'$  such: $W-10 \leq W'\leq W+10$ ?


I think this problem is NP complete.

My idea was to create a reduction from subset sum to this problem:
I thought to add the all the number between -10 to 10 : {-10,-9,-8....,0,1,2,....10} to ${\displaystyle w_{1},\ldots ,w_{n}}$
and now i can find any $W'$.


  2.Just like 3-dimensional matching:
  Let X, Y, and Z be finite, disjoint sets, and let T be a subset of X × Y × Z. That is, T consists of triples (x, y, z) such that x ∈ X, y ∈ Y, and z ∈ Z. Now M ⊆ T is a 3-dimensional matching if the following holds: for any two distinct triples $(x_1, y_1, z_1) ∈ M$ and $(x_2, y_2, z_2) ∈ M,$ we have $x_1 ≠ x_2, y_1 ≠ y_2$, and $z_1 ≠ z_2$.


But now:


  each vertex can be in only 3 triples.Is there a $M' ⊆ M$ that is a perfect matching?


I think this problem is in P .to prove this I thought about (hopefully polynomial) algorithm:

a.take a random vertex and find all the matches that he's in .

b.If the vertex is in only 1 match,put this match in M' and delete it form M.
otherwise do nothing.
(and delete all the vertex in this match from the hypergraph and all the matching they are in)

repeat a and b 3 times.It should take $O(3|X||Y||Z||M|)$.

Is my answers right?
Your first problem is $\mathsf{NP}$-Complete. Membership to $\mathsf{NP}$ is trivial. To see that it is $\mathsf{NP}$-hard, you can reduce it from Subset Sum. Let $\langle S_1, W_1 \rangle$ be an instance of Subset Sum. Define $S_2$ as the multiset obtained by multiplying each number in $S_1$ by $100$, and $W_2 = 100 W_1$. The instance for your problem is $\langle S_2, W_2 \rangle$.

If there is a set $C_1 \subseteq S_1$ such that $\sum_{x \in C_1} x  = W_1$, then let $W'$ be the sum of the elements in corresponding subset for $S_2$. We have $W' = \sum_{x \in C_1} 100x = 100 \cdot W_1 = W_2 \in \left[W_2-10, W_2+10\right]$.

If there is a set $C_2 \subseteq S_2$ such that the sum $W' = \sum_{x \in C_2} x$ of its elements satisfies $W_2-10 \le W' \le W_2+10$, then pick $y   = W' - W_2$, so that $W'  = W_2 + y$ and $y \in [-10, 10]$.
We must have $y=0$ since $W' = W_2 + y = y \pmod{100}$ and $W'$ must be a multiple of $100$. This shows that $W' = W_2$  and that the corresponding subset of $S_1$ has a sum of $\sum_{x \in C_2} \frac{x}{100} = \frac{W'}{100} = \frac{W_2}{100} = W_1$.

Your second problem is already known to be $\mathsf{NP}$-Complete even when when no vertex occurs in more than three triples. See problem SP1 in  "Garey &amp; Johnson, Computer and intractability: a guide to the theory of NP-completeness".