Construct an order-preserving bijection from $\mathbb{Q}$ to a countably dense subset of $\mathbb{R}$ I've been stuck on this problem (not homework, just an additional exercise) for quite some time now and I wanted to see if you folks had any ideas:
Let $K\subset\mathbb{R}$ be a countable dense subset. Construct an order-preserving bijection $f:\mathbb{Q}\to K$.

Take two enumerations $K=(a_k)_{k\ge 1}$ and $\Bbb{Q}=(b_j)_{j\ge 1}$.
For $n\in \Bbb{Z}$ set $f(n)$ to the first element of the sequence such that $a_k\in [n,n+1)$.

*

*Then repeat:
take the first $b_i$ not set yet, take the rationals $u<b_i<v$ such that $f(u),f(v)$ are already set and nothing in $(u,v)$ has been set.  ​Set $f(b_i)$ to the first $a_k$ such that $a_k\in (f(u),f(v))$.
This will give an order preserving injection $\Bbb{Q}\to K$ and it is not hard to see that every element of $K$ will be the image of some rational.
