Optimized update algorithm for minsum and automatic update algorithm selection