Is there a function like this? Let $A=[0,1]$ and $C=\{0\}\cup\{\frac{1}{n},\ n\in\mathbb{N}\}$.
i) Is there a function $f:A\rightarrow\mathbb{R}$ such that $f\in C^{r}(A)$, $r\geq 2$ and the set of critical "Values" of $f$ is $C$?
ii) Is there a function $f:A\rightarrow\mathbb{R}$ such that $f\in C^{1}(A)$ and the set of critical "Values" of $f$ is $-C\cup C$?
This is a problem from a course of differential topology that i did last year. Is related with Morse theory. I couldn't figure out any good solution for it. I appreciate some help. 
EDIT: A critical value is image of a critical point, i.e. if $f'(x)=0$ then $f(x)$ is a critical value.
Thanks
 A: The answer to question (i) is no, the answer to question (ii) is yes. (Thanks to Tomas for pointing out a mistake in my previous argument.)
(ii) Existence of the $\mathcal{C}^1$ function. Let $F:[0,1]\to[0,1]$ be a $\mathcal{C}^1$ function such that $F(0)=0$, $F(1)=1$, $F'(0)=F'(1)=0$, and such that $F'(x)>0$ for all $x \in (0,1)$. (E.g., one could use $F(x) = \sin^2 \frac{\pi x}{2}$.)
Now let $a_n$ be a strictly decreasing positive sequence with $a_1 = 1$ and $\lim\limits_{n\to\infty} a_n = 0$. Define the function $f$ on the interval $[a_{n+1},a_n]$ by $$f(x) = \frac{1}{n+1} + \left(\frac1n - \frac{1}{n+1}\right) F\left(\frac{x-a_{n+1}}{a_{n}-a_{n+1}}\right)$$ for all $n$. I.e., $f$ is an affine version of $F$ with $f(a_n) = \frac1n$ and $f(a_{n+1}) = \frac1{n+1}$. This already gives us a (strictly increasing) $\mathcal{C}^1$ function $f:(0,1] \to \mathbb{R}$ with critical values $\{ \frac1n:n \in \mathbb{N} \}$. Extending it to $[0,1]$ by $f(0)=0$ makes the function continuous. Now we just have to find a sequence $(a_n)$ for which this function satisfies $\lim\limits_{x\to 0} f'(x) = 0$. Then the odd extension of $f$ to $[-1,1]$ is $\mathcal{C}^1$ and has critical values $C \cup (-C)$.
Letting $M = \sup F'$, we get for all $x\in[a_{n+1},a_n]$ that $$0<f'(x) \le M\frac{\frac1n - \frac{1}{n+1}}{a_n - a_{n+1}}.$$ As $x\to 0$, we get $n\to\infty$, so we have to find a sequence such that $$\lim\limits_{n\to\infty} \frac{\frac1n - \frac1{n+1}}{a_n - a_{n+1}} = 0.$$ Many sequences work here, e.g., $a_n = \frac1{\sqrt{n}}$ or $a_n = \frac{1}{1+ \ln n}$. This finishes the argument.
(i) Non-existence of the $\mathcal{C}^2$ function. Assume that $f$ is $\mathcal{C}^2$ on $[0,1]$ with critical values $C$. Then there exists a sequence of disjoint intervals $I_n = [a_n,b_n]$ with critical points $a_n$, $b_n$, no critical points in $(a_n,b_n)$, and $f(a_n) \ge \frac1n$ or $f(b_n) \ge \frac1n$. (This is shown by an elementary, but not quite trivial argument.) This implies that $$|f(a_n)-f(b_n)| \ge \frac1n - \frac1{n+1}= \frac1{n(n+1)}\ge \frac{1}{2n^2}.$$ By the Mean Value Theorem there exists $c_n \in (a_n,b_n)$ with $$|f'(c_n)|\ge \frac{1}{2n^2(b_n-a_n)}.$$ Since $f'(a_n) = 0$, another application of the Mean Value Theorem to $f'$ shows that there exists $d_n \in (a_n,c_n)$ with $$|f''(d_n)| \ge \frac{1}{2n^2(c_n-a_n)(b_n-a_n)} \ge \frac{1}{2n^2(b_n-a_n)^2}.$$ By assumption $f$ is $\mathcal{C}^2$, so $|f''| \le M$ for some constant $M$, implying that $$b_n-a_n \ge \frac{1}{n\sqrt{2M}}.$$ This gives $\sum\limits_{n=1}^\infty (b_n-a_n) = +\infty$. However, since these intervals are mutually disjoint subsets of $[0,1]$, we have $\sum\limits_{n=1}^\infty (b_n-a_n) \le 1$, which is the desired contradiction.
A: In each case, the answer is yes. Check out this post by Mate on the Topology Q+A board.  To adapt it to your question:
You need this lemma, which isn't so hard to prove if you already know about bump functions:

For any $a,b,c,d \in \mathbb{R}$ with $a<b$, there exists a smooth function $f:[a,b] \rightarrow \mathbb{R}$ such that $f(a) = c, f(b) = d$, and all the derivatives of $f$ vanish at $a$ and $b$.

Now let $r: \mathbb{N} \rightarrow \mathbb{Q}$ be your favorite enumeration the set $C$ (or $-C \cup C$).  Extend $r$ to a smooth function $f$ on the (positive) real numbers using the lemma.  This function satisfies all your requirements.
