An efficient policy iteration algorithm for dynamic programming equations