Algorithmic Foundations