... G(i−2, j2, k)× P (j1|j2) × P(l|j2j1)).end for end for for i = 4 to r do for (l, k) such that σ ∪ {k : c, l : Ci} is con-sistent do for j1, j2such that σ ∪ {k : c, j2:C[i−2], ... G to 0.i = 1 for All (l, k) such that σ ∪ {k : c, l : Ci} isconsistent doG(i, l, k) = P (l).end for i = 2 for All (l, k) such that σ ∪ {k : c, l : Ci} isconsistent do for j such that ... doG(i, l, k) = max(G(i, l, k), G(0, j, k) ×P (l|j))end for end for i = 3 for (l, k) such that σ ∪ {k : c, l : Ci} is consis-tent do for j1, j2such that σ∪{k : c, j2: C[i−2], j1:C[i...