code used in open courseware for CS course