Exercise for learning data structures and algorithm analysis