Solutions and common sub routines for algorithm problems