Code for algorithm learning