Algorithms and Complexity I