Algorithm to find exactly two sets of numbers that have the same sum I am searching for the most efficent implementation of a specific algorithm:

Assume you have a set of positive integers, for example:

X = [1,1,2,3,3,6,8]

The aim is to find exactly two sets (containing together all elements of X), so that the sum of all elements of the one is equal to the sum of the other.

So for example a solution would be (there can be more than one solution of course, or no solution):
A = [1,2,3,6]
B = [1,3,8]

(Sorry if my wording is wrong, just a curious developer and no computer scientist)
This is called the Partition Problem, and it's NP-complete, meaning that it's very unlikely that any algorithm can solve every instance of the problem quickly. On the bright side, if there are $n$ numbers and their total sum is $t$, there is a fairly simple $O(nt)$-time dynamic programming algorithm (see section "Pseudo-polynomial time algorithm" on that webpage), and this is fast enough to solve many practical instances.