4 ms·
Right. Not sorting each one by absolute height, but sorting into "bins" so that you have books of similar height, which then can be subsequently sorted for plac
by zvr 2y ago
Right. Not sorting each one by absolute height, but sorting into "bins" so that you have books of similar height, which then can be subsequently sorted for placement in a shelf of appropriate clearance.
Even more, if your bookcase has adjustable shelves (for example, via dowels), you can compute the optimal shelf arrangement and book placement, totally customized to your books.
And if you want extra credit, also take into consideration the width of each book, so you know when you reach the shelf size.
I do not admit of having spent hours on this many years ago, nor of still having the code solving it somewhere.