Programming Foundations: Algorithms