Skip to main content

Table 2 The Inside VMT algorithm

From: Reducing the worst case running times of a family of RNA and CFG problems, using Valiant’s approach

Inside-VMT (s)

   1:    Allocate a matrix B of size ||s|| × ||s||, and initialize all entries in B with ϕ elements.

   2:    Call Compute-Inside-Sub-Matrix ([0, n], [0, n]), where n is the length of s.

   3:    return B

Compute-Inside-Sub-Matrix (I, J)

pre-condition: The values in B[I,J], [I,J], excluding the values in BI,J, are computed, and BI,J= βI,(I,J) β(I,J),J.

post-condition: B[I,J], [I,J]= β[I,J], [I,J].

   1:    if I = [i, i] and J = [j, j] then

   2:       If ij, compute βi,j(in o (||s||) running time) by querying computed values in B and the value μi,jwhich is stored in Bi,j. Update Bi,jβi,j.

   3:    else

   4:       if |I| ≤ |J| then

   5:          Let J1 and J2 be the two intervals such that J1J2 = J, and |J1| = |J|/2.

   6:          Call Compute-Inside-Sub-Matrix (I, J1).

   7:          Let L be the interval such that (I, J)L = (I, J2).

   8:          Update B I , J 2 B I , J 2 ( B I , L B L , J 2 ) .

   9:          Call Compute-Inside-Sub-Matrix (I, J2).

   10:       else

   11:          Let I1 and I2 be the two intervals such that I2I1 = I, and |I2| = |I|/2.

   12:          Call Compute-Inside-Sub-Matrix (I1, J).

   13:          Let L be the interval such that L(I, J) = (I2, J).

   14:          Update B I 2 , J ( B I 2 , L B L , J ) B I 2 , J .

   15:          Call Compute-Inside-Sub-Matrix (I2, J).

   16:       end if

   17:    end if