Implemented Pseudo code.
Chapter 5 hw.