some algorithms implemented by myself