Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem you are facing is a well known and studied one, and is called <strong><a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="nofollow">The Subset Sum Problem</a></strong>.</p> <p>Unfortunately, the problem is <a href="http://en.wikipedia.org/wiki/NP-complete" rel="nofollow">NP-Complet</a>e, so <strong>there is no known polynomial solution for it</strong><sup>1</sup>. <br>In fact, there is no known polynomial solution to even determine if such a subset (even a single one) exists, let alone find it.</p> <p>However, if your input consists of relatively small (absolute value) integers, there is a pretty efficient (pseudo polynomial) <a href="http://en.wikipedia.org/wiki/Subset_sum_problem#Pseudo-polynomial_time_dynamic_programming_solution" rel="nofollow"><strong>dynamic programming solution</strong></a> that can be utilized to solve the problem.</p> <p>If this is not the case some <strong>other alternatives</strong> are:</p> <ol> <li>Using exponential solution like <a href="http://en.wikipedia.org/wiki/Brute-force_search" rel="nofollow">brute force</a> (you might be able to optimize it using <a href="http://en.wikipedia.org/wiki/Branch_and_bound" rel="nofollow">branch and bound</a> technique)</li> <li>Heuristical solutions, such as <a href="https://en.wikipedia.org/wiki/Hill_climbing" rel="nofollow">Steepest Ascent Hill Climbing</a> or <a href="http://en.wikipedia.org/wiki/Genetic_algorithm" rel="nofollow">Genethic Algorithm</a>s.</li> <li><a href="http://en.wikipedia.org/wiki/Subset_sum_problem#Polynomial_time_approximate_algorithm" rel="nofollow">Approximation algorithm</a>s</li> </ol> <hr> <p>(1) And most computer science researchers believe one does not exist, this is basically the <a href="https://en.wikipedia.org/wiki/P_versus_NP_problem" rel="nofollow">P VS NP Problem</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload