adding solution to data structures exercie