Adding algorithm to do rotation with an example