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$.
 A: 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.
A: HINT:
Let $A$ be a  totally ordered set with a labelling $N \to A$ ( $N$ is $\mathbb{N}$ or a segment of it).   Construct the binary search tree associated to $A$ with its labelling.
Fact: if $A$ has no largest nor smallest element and  is dense in itself ( for every $a<b$ in $A$ there exists $c$ in $A$ with $a< c< b$), then its binary search  tree is the complete infinite rooted binary tree (not hard to show, also the converse).
Get the bijection ( embedding) using the binary search trees.
