basic data structure and algorithm exercise.