A Java exercise for my class on algorithms and data structures at Grinnell College