Largest differencing method: Difference between revisions

Content deleted Content added
Monkbot (talk | contribs)
m Task 18 (cosmetic): eval 7 templates: del empty params (5×); hyphenate params (1×); cvt lang vals (1×);
mNo edit summary
Line 18:
Step 3 constructs the subsets in the partition by backtracking. The last step corresponds to {2},{}. Then 2 is replaced by 3 in one set and 1 in the other set: {3},{1}, then {4},{1,1}, then {4,7}, {1,8}, then {4,7,5}, {8,6}, where the sum-difference is indeed 2.
 
The runtime complextiycomplexity of this algorithm is dominated by the step 1 (sorting), which takes O(''n'' log ''n'').
 
Note that this partition is not optimal: in the partition {8,7}, {6,5,4} the sum-difference is 0. However, there is evidence that it provides a "good" partition: