because data structures are great awesome
Problem 4.20 from Drake's Data Structures and Algorithms in Java. To be backfilled.