3 ms·
We have used Knapsack 0-1 algorithm, since in our case images had different widths but the same height, we wanted to fit in as many images as possible so that t
by gauravsc 14y ago
We have used Knapsack 0-1 algorithm, since in our case images had different widths but the same height, we wanted to fit in as many images as possible so that they fit in the best way possible. We gave value 1 to each image and weight equal to width and use the total width of container of images as the maximum weight allowed.
- jahewson 14y agoKnapsack 0-1 is a (special case) problem, not an algorithm.
- gauravsc 14y agoWell as far as my knowledge goes, any sequence of steps to solve a problem is an algorithm(some are simple algorithms and some are complex). In our case we couldn't use fractional knapsack since we couldn't break images.
- jahewson 14y agoYes, the steps used to solve the problem are indeed the algorithm... But the question stands: what algorithm did you use?
- vog 14y agoSo which algorithm did you use to solve the Knapsack 0-1 problem? Via Dynamic Programming? Or using the Meet-in-the-Middle Algorithm? Or a greedy approximation algorithm?