Backtracking - Sum of Subset Problem

Backtracking - sum of subset


Sum of Subset Problem

Promising Function

bool promising(int idx) {
	return (weight + total >= W) && // case 1
	(weight == W || weight + S[idx+1] <= W); // case 2
}

State Space Tree

Solution