code from CSC-190 data structures 1