News for hackers. Stuff that matters.
Re:JQuery plugin to arrange images using knapsack algorithm by vog on Tuesday April 24, 2012 @04:19AM (#3882984)
Great idea! However, the term "knapsack algorithm" is quite misleading.

There is the "knapsack problem", but there are various different algorithms to solve it. Which of those has been used? Why this and not another algorithm? All those questions are concealed behind the squishy term "knapsack algoritm".

Re:JQuery plugin to arrange images using knapsack algorithm by gauravsc on Tuesday April 24, 2012 @04:27AM (#3882999)
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.
Re:JQuery plugin to arrange images using knapsack algorithm by jahewson on Tuesday April 24, 2012 @05:04AM (#3883069)
Knapsack 0-1 is a (special case) problem, not an algorithm.
Re:JQuery plugin to arrange images using knapsack algorithm by gauravsc on Tuesday April 24, 2012 @05:26AM (#3883106)
Well 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.
Re:JQuery plugin to arrange images using knapsack algorithm by jahewson on Tuesday April 24, 2012 @05:33AM (#3883124)
Yes, the steps used to solve the problem are indeed the algorithm... But the question stands: what algorithm did you use?
Re:JQuery plugin to arrange images using knapsack algorithm by vog on Wednesday April 25, 2012 @06:47AM (#3888502)
So 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?