some algorithm implemented in go