The 6 programs for Algorithms 1