demo LCS longest_common subsequence

problem : given two strings x and y, find the longest common subsequence (LCS) and print its length % Example: % x: abcic
0 download
Aggiornato 2 nov 2025

Visualizza la licenza

% code_m
% problem : given two strings x and y, find the longest common
% subsequence (LCS) and print its length
% Example:
% x: abcicba
% y: abdkscab
% "abca" is the longest subsequence found in both sequences, so the
% answer is 4
%{
How to slove this problem?
This demo is show how to find LCS using dynamic programming algorithem.
D(i,j):
if x(i -1) == y(i - 1)
D(i - 1, j - 1)
else
max(D(i - 1, j), D(i, j - 1))
Then do trace back
%}

Cita come

shen vincent (2025). demo LCS longest_common subsequence (https://it.mathworks.com/matlabcentral/fileexchange/182449-demo-lcs-longest_common-subsequence), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2025b
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Tag Aggiungi tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0