data structures

Redo of the homework with a proper pull request.  No changes to the code itself.
is there a way you can do this without a double for loop?