Code for programming assignments from Algorithms Part II