Initialize minimum space left and index of best bin
min = c + 1 ; NEW_LINE bi = 0 ; NEW_LINE for j in range ( res ) : NEW_LINE INDENT if ( bin_rem [ j ] >= weight [ i ] and bin_rem [ j ] - weight [ i ] < min ) : NEW_LINE INDENT bi = j ; NEW_LINE min = bin_rem [ j ] - weight [ i ] ; NEW_LINE DEDENT DEDENT