some algorithm myself realize it