A new algorithm,but it stll runs slowly.