backtrackLCS {runibic}R Documentation

Retrieving a Longest Common Subsequence between two integer vectors.

Description

This function retrieves the Longest Common Subsequence (LCS) between two integer vectors by backtracking the matrix obtained with dynamic programming.

Usage

backtrackLCS(x, y)

Arguments

x

an integer vector

y

an integer vector

Value

an integer vector containing the the Longest Common Subsequence (LCS) between vectors x and y (i.e. the values that appear in both x and y in the same order)

See Also

runibic pairwiseLCS calculateLCS

Examples

A <- c(1, 2, 3, 4, 5)
B <- c(1, 2, 4)
backtrackLCS(A, B)

[Package runibic version 1.12.0 Index]