Exercise for the book of DataStructure