Finish exercise 3.11

Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>