Design and Analysis of Algorithms20815 marksNumerical: Subset sum backtrackingBacktracking Algorithms
Given a set A=5,7,10,12,15,18,20, find the subset that sum to 35 using backtracking.
Given a set $A={5,7,10,12,15,18,20}$, find the subset that sum to 35 using backtracking. [5]
- Set $A = {5, 7, 10, 12, 15, 18, 20}$ (sorted in increasing order) - Target sum $M = 35$ - Number of elements $n = 7$ Total of all elements = $5+7+10+12+15+18+20 = 87$. --- Backtracking explores a binary state-space tree. At element $i$ we branch: - Left (include): add $wi$ to the running sum ...