Algorithms and Complexity