So we are asked to prove that two sub-spaces of euclidean plane, namely $A=\mathbb{N}\times (\{\frac{1}{i}|i\in \mathbb{N}\}\cup\{0\})$ and $B=\mathbb{N} \times (\mathbb{N}\cup \{\frac{1}{i}|i\in \mathbb{N}\}\cup \{0\})$ are homeomorphic. So I thought standard metric induces discrete metric on both, but not really because at zero we will never get singleton, i.e. $\{(x,0)\}\neq B_{\epsilon}((x,0))\cap A$ no matter how small epsilon is (same for $B$). So pretty much it induces topology that is discrete-like everywhere but at $(x,0)$. So any bijection that maps $(x,0)$ neighborhoods to $(x,0)$ neighborhoods will do the job (inverse image open because discrete for the rest). And here I am stuck. Is this reasoning all right?
My first idea (but wrong one) for a function was:
let $f:A\to B$ such that $f(x,y)=\begin{cases} (\frac{x}{2},y)&\text{for} &x=2n, &n\in\mathbb{N} \\(\frac{x-1}{2},\frac{1}{y}) &\text{for} &x=2n+1, &n\in\mathbb{N}\end{cases}$
f is injective, surjective, but for $y_i=1/i$ in $A$ $(1,y_i)$ converges to ${0}$ and $f((1,y_i))$ does not converge to a finite limit in $B$. So it is not homeo.
Your formula for $f$ is not even surjective. For example, its image does not contain $(1,1/2)$ because if $f(x,y) = (1,1/2)$ then $y=2$ and $x=2$ or $3$, but $(2,2) \not\in A$ and $(3,2) \not\in A$.
But you should be able to turn your idea into a real proof.
First, I notice that the set $$C = \mathbb N \times \left(\{\frac{1}{n} \mid n \ge 2\} \cup \{0\}\right) $$ is a subset of both $A$ and $B$, and furthermore $C$ contains neighborhoods of all the limit points. So we might as well start by requiring that the restricted function $f \mid C$ is the identity map $$f_1(x,y)=(x,y), \quad (x,y) \in C $$ Now we are left with $$A - C = \mathbb N \times \{1\} $$ $$B - C = \mathbb N \times \mathbb N $$ These are discrete, countable, clopen subsets of $A,B$ respectively. Any bijection $f_2 : A-C \mapsto B-C$ is a homeomorphism, and the $$f(x,y) = \begin{cases} f_1(x,y)=(x,y) & \quad (x,y) \in C \\ f_2(x,y) & \quad (x,y) \in A-C \end{cases} $$ is a homeomorphism by application of the gluing theorem.