Code I implemented in Data Structures class.