Interview questions from Algorithms, Part I by Kevin Wayne, Robert Sedgewick