Here you can find the source of LCSRecursive(Character[] X, int i, Character Y[], int j, int c[][])
private static int LCSRecursive(Character[] X, int i, Character Y[], int j, int c[][])
//package com.java2s; //License from project: Open Source License public class Main { private static int LCSRecursive(Character[] X, int i, Character Y[], int j, int c[][]) { if (c[i][j] == Integer.MIN_VALUE) { if (X[i - 1].equals(Y[j - 1])) { c[i][j] = 1 + LCSRecursive(X, i - 1, Y, j - 1, c); } else { c[i][j] = Math.max(LCSRecursive(X, i - 1, Y, j, c), LCSRecursive(X, i, Y, j - 1, c)); }/*from w w w. j a v a 2s . co m*/ } return c[i][j]; } }