Existence of embeddings does not imply the existence of a homeomorphism

Suppose there exist embeddings $f:X\to Y$ and $g:Y\to X$. Show by means of an example that $X$ and $Y$ need not be homeomorphic.

I set $X=(0,1)$ and $Y=(0,\frac{1}{2})\cup (\frac{1}{2}, 1)$. I think $f:X\to Y$ defined by $f(x)=\frac{x}{2}$ is an embedding, correct? Also, clearly $g:Y\to X$ defined by $g(y)=y$ is an embedding. But as $X$ is connected and $Y$ is disconnected, there is no homeomorphism between them.

Is this okay?

-
Seems correct to me. – Ilya Jun 24 '13 at 11:07
See also this previous question of mine: math.stackexchange.com/questions/465048/… – Luca Bressan Oct 17 '13 at 16:41

Yes, seems correct to me. In this mathoverflow question I asked for even more stringent examples (continuous bijections both ways, but not homeomorphic). Note that there can no bijection from $X$ onto $Y$ in your example by the same connectedness reason. So more complex examples can be found there as well.
Take $X=(0,1)$ and $Y=[0,1]$. Clearly the spaces are not homeomorphic because one is compact and the other is not; but the map $x\mapsto\frac{1+x}4$ is an imbedding from $X$ into $Y$ and from $Y$ into $X$.