Difference Equations with Applications to Queues