work done for Stanford's Mining Massive Datasets course