  Let $K$ be a non-archimedean local field with residue field of characteristic
$p$. We give necessary and sufficient conditions for a two-generator subgroup
$G$ of ${\rm PSL_2}(K)$ to be discrete, where either $K=\mathbb{Q}_p$ or $G$
contains no elements of order $p$. We give a practical algorithm to decide
whether such a subgroup $G$ is discrete. We also give practical algorithms to
decide whether a two-generator subgroup of either ${\rm SL_2}(\mathbb{R})$ or
${\rm SL_2}(K)$ (where $K$ is a finite extension of $\mathbb{Q}_p$) is dense. A
crucial ingredient for this work is a structure theorem for two-generator
groups acting by isometries on a $\Lambda$-tree.
