This is exercise for the book of Data Structure.