Some algorithms and some solution to a problem