Click here to Skip to main content
15,890,512 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionAlgorithm to find maximum sum in an array given that the elements have unique digits Pin
akshit bhatia28-May-19 9:02
akshit bhatia28-May-19 9:02 
AnswerRe: Algorithm to find maximum sum in an array given that the elements have unique digits Pin
Patrice T1-Jun-19 10:12
mvePatrice T1-Jun-19 10:12 
QuestionXamarin Platform Pin
Member 1447108926-May-19 5:50
Member 1447108926-May-19 5:50 
AnswerRe: Xamarin Platform Pin
OriginalGriff26-May-19 5:51
mveOriginalGriff26-May-19 5:51 
Question[solved] Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 1433642827-Apr-19 2:23
Member 1433642827-Apr-19 2:23 
AnswerRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
OriginalGriff27-Apr-19 2:25
mveOriginalGriff27-Apr-19 2:25 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 1433642827-Apr-19 5:29
Member 1433642827-Apr-19 5:29 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
ChrisFromWales1-May-19 0:09
ChrisFromWales1-May-19 0:09 
I shouldn't be telling you this, but the answers to your questions are Yes and No.

Yes this is a classic (I mean classical) problem (it has been extensively studied since 1897), and No there is no algorithm that can find an optimal solution in polynomial time (i.e. quickly enough). You should also be advised that if you do discover such an algorithm for this problem, you will earn the one million dollar prize put up by the Clay Mathematics Institute for being the first person to show that P = NP.

I suppose you want to know what this classical problem is called. But as OriginalGriff quite rightly said, you should think about whether there are any optimizations you can make to your simple algorithm. Such things generally involve noting under what circumstances can some aspect of the problem be simplified. One might, for example, investigate the circumstances that would lead you to conclude that item A will never be part of an optimal solution because you can always do better than item A if you were to replace it with a set of items B, C, ... that taken together are both lighter and more valuable than A. Or perhaps you could define some substitution arrangement that is more complicated than just swapping out one item for another item as you pack your … er … um …

knapsack.
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 143364281-May-19 6:49
Member 143364281-May-19 6:49 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Richard Deeming1-May-19 8:09
mveRichard Deeming1-May-19 8:09 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 143364282-May-19 4:19
Member 143364282-May-19 4:19 
GeneralRe: Find the sublist of objects with the highest value without exceeding weight limit Pin
Member 143364281-May-19 11:09
Member 143364281-May-19 11:09 
QuestionAlgorithm to compress Image to RGB565 for embedded screen Pin
XxKeldecknightxX24-Apr-19 8:10
XxKeldecknightxX24-Apr-19 8:10 
AnswerRe: Algorithm to compress Image to RGB565 for embedded screen Pin
Gerry Schmitz24-Apr-19 8:56
mveGerry Schmitz24-Apr-19 8:56 
GeneralRe: Algorithm to compress Image to RGB565 for embedded screen Pin
XxKeldecknightxX24-Apr-19 11:21
XxKeldecknightxX24-Apr-19 11:21 
QuestionGet all groups in 4x4 matrix with width and height of power 2 Pin
Member 142151775-Apr-19 6:59
Member 142151775-Apr-19 6:59 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Richard MacCutchan5-Apr-19 8:51
mveRichard MacCutchan5-Apr-19 8:51 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Member 142151776-Apr-19 1:26
Member 142151776-Apr-19 1:26 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Richard MacCutchan6-Apr-19 4:32
mveRichard MacCutchan6-Apr-19 4:32 
GeneralRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Member 142151776-Apr-19 5:18
Member 142151776-Apr-19 5:18 
AnswerRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Gerry Schmitz6-Apr-19 10:13
mveGerry Schmitz6-Apr-19 10:13 
AnswerRe: Get all groups in 4x4 matrix with width and height of power 2 Pin
Daniel Pfeffer6-Apr-19 21:16
professionalDaniel Pfeffer6-Apr-19 21:16 
QuestionTracking Sales and returns. Pin
Member 1420060727-Mar-19 20:22
Member 1420060727-Mar-19 20:22 
QuestionHow to find a good algorithm to fill a dense grid? Pin
Member 141732236-Mar-19 4:36
Member 141732236-Mar-19 4:36 
QuestionHow to calculate the number of labels available on a roll Pin
Member 1409963724-Feb-19 20:10
Member 1409963724-Feb-19 20:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.