This book presents and applies a framework for studying the complexity of algorithms. It is aimed at logicians, computer scientists, mathematicians and philosophers interested in the theory of computation and its foundations, and it is written at a level suitable for non-specialists. Part I provides an accessible introduction to abstract recursion theory and its connection with computability and complexity. This part is suitable for use as a textbook for an advanced undergraduate or graduate course: all the necessary elementary facts from logic, recursion theory, arithmetic and algebra are included. Part II develops and applies an extension of the homomorphism method due jointly to the author and Lou van den Dries for deriving lower complexity bounds for problems in number theory and algebra which (provably or plausibly) restrict all elementary algorithms from specified primitives. The book includes over 250 problems, from simple checks of the reader's understanding, to current open problems.