Here you can find the source of LCSIterative(Character[] X, int i, Character Y[], int j, int c[][])
private static void LCSIterative(Character[] X, int i, Character Y[], int j, int c[][])
//package com.java2s; //License from project: Open Source License public class Main { private static void LCSIterative(Character[] X, int i, Character Y[], int j, int c[][]) { for (int a = 1; a <= i; ++a) { for (int b = 1; b <= j; ++b) { if (X[a - 1] == Y[b - 1]) { c[a][b] = 1 + c[a - 1][b - 1]; } else { c[a][b] = Math.max(c[a - 1][b], c[a][b - 1]); }// w w w . j a v a2s . co m } } } }