Basic Algorithms that we keep writing everytime