The only algorithm you will ever need