two high efficient algorithm