human
Minimum absolute difference of server loads | Function which returns the minimum difference of loads.
Compute the overall server load.
Stores the results of subproblems.
Fill the partition table in bottom up manner.
If i - th server is included.
If i - th server is excluded.
Server A load : total_sum - ans Server B load : ans Diff : abs ( total_sum - 2 * ans ).
Driver Code.
Function Call"
Solution in Python:
assistant
#Here is code to minimum absolute difference of server loads and the other steps required.
 def minServerLoads ( n , servers ) :
	totalLoad = sum ( servers )
	requiredLoad = totalLoad // 2
	dp = [ [ 0 for col in range ( requiredLoad + 1 ) ] for row in range ( n + 1 ) ]
	for i in range ( 1 , n + 1 ) :
		for j in range ( 1 , requiredLoad + 1 ) :
			if servers [ i - 1 ] > j :
				dp [ i ] [ j ] = dp [ i - 1 ] [ j ]
			else :
				dp [ i ] [ j ] = max ( dp [ i - 1 ] [ j ] , servers [ i - 1 ] + dp [ i - 1 ] [ j - servers [ i - 1 ] ] )
	return totalLoad - 2 * dp [ n ] [ requiredLoad ]
N = 5 ;
servers = [ 1 , 2 , 3 , 4 , 5 ]
print ( minServerLoads ( N , servers ) )