An algorithm for unsteady transonic potential flow past airfoils