code assignment for algs4