Completed functions for assignment.  The code correctly solves the example given by Gregory D. Horne on the discussion forums: https://class.coursera.org/rprog-005/forum/thread?thread_id=140#post-870