this file contains the functions as required by the assignment2. It also contains a few sample tests in the comments at the bottom of the file