title: Recurrence functions with if statements
body: <p>I am having some trouble building this recurrence relation.</p>
  
  <p>We have three strings:</p>
  
  <pre><code>x=x1x2x3....xn
  
  y=y1y2y3....ym
  
  z=z1z2z3....zm
  </code></pre>
  
  <p>The problem is to find the length of the longest sequence that is a subsequence of all three sequences.</p>
  
  <p>The recurrence I have built looks like this:</p>
  
  <pre><code>T(i,j,k)= O(1)                       if i=0 or j=0 or k=0
            T(i-1,j-1,k-1)             if(x[i]==y[j]==z[k])
            max(T(i-1,j,k)+T(i,j-1,k)
                 +T(i,j,k-1))          otherwise
   where i is the length of x
         j is the length of y
         k is the length of z
  </code></pre>
  
  <p>I was wondering if this was correct, since i am not sure if we can use if(x[i]==y[j]==z[k]) as a case</p>