Protein folding and phylogenetic tree reconstruction using stochastic approximation Monte Carlo