The library has n books that must be stored in alphabetical order on adjustableheight shelves. Each book has a height and a thickness. The width of the shelf is fixed at w,and the sum of the thicknesses of books on a single shelf cannot exceed w. The next shelfwill be placed on top, at a height equal to the maximum height of a book on the shelf.Give an efficient algorithm that minimizes the total height of shelves used to store all thebooks. You are given the list of books in alphabetical order, bi = (hi, ti), where hiis theheight and tiis the thickness, and the shelf width w.
Need the algorithm and proof of correctness