Basic algorithms(Just implement these thing for reusing later)