A Bandit Learning Algorithm and Applications to Auction Design