I am taking an Algorithm course, and here is my code.