设 X=( c, b, d, b), Y=( b, a, b, d, b, b) 写出c表格和b表格 写出最长公共子序列长度和最长公共子序列
时间: 2023-12-22 16:06:19 浏览: 20
c表格:
| | | b | d | b |
|---|---|---|---|---|
| c | 1 | 0 | 0 | 0 |
| b | 0 | 1 | 0 | 1 |
| d | 0 | 0 | 1 | 0 |
| b | 0 | 1 | 0 | 1 |
b表格:
| | b | a | b | d | b | b |
|---|---|---|---|---|---|---|
| c | 0 | 0 | 0 | 0 | 0 | 0 |
| b | 1 | 0 | 2 | 0 | 3 | 4 |
| d | 0 | 0 | 0 | 1 | 0 | 0 |
| b | 1 | 0 | 2 | 0 | 3 | 4 |
其中,c表格中的数字表示X和Y中前i个字符和前j个字符的LCS长度;b表格中的数字表示X和Y中前i个字符和前j个字符的LCS中,以X[i]结尾和以Y[j]结尾的子序列长度。
最长公共子序列长度为4,最长公共子序列为"b, d, b, b"。
相关问题
3 设 X=( c, b, d, b), Y=( b, a, b, d, b, b) 写出c表格和b表格 写出最长公共子序列长度和最长公共子序列
c表格:
| | | b | a | b | d | b | b |
|---|---|---|---|---|---|---|---|
| c | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| b | 0 | 0 | 1 | 1 | 2 | 2 | 3 |
| d | 0 | 0 | 1 | 1 | 2 | 3 | 3 |
| b | 0 | 0 | 2 | 2 | 3 | 3 | 4 |
b表格:
| | | b | a | b | d | b | b |
|---|---|---|---|---|---|---|---|
| c | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| b | 0 | 1 | 0 | 0 | 1 | 1 | 2 |
| d | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
| b | 0 | 1 | 0 | 0 | 2 | 2 | 3 |
最长公共子序列长度为 3,最长公共子序列为 "b d b"。
表达式!x||a==b等效于
将字符串转换为ASCII码表示,结果为:b"\xe8\xae\xbe c = 'w', a = 1, b = 2, d = -5\xef\xbc\x9b \xef\xbc\x8c\xe5\x86\x99\xe5\x87\xba\xe4\xb8\x8b\xe5\x88\x97\xe8\xa1\xa8\xe8\xbe\xbe\xe5\xbc\x8f\xe7\x9a\x84\xe5\x80\xbc\xef\xbc\x9a 'x' + 1 > c\xef\xbc\x9a 'y' != c + 2\xef\xbc\x9a -a - 5 * b <= d + 1\xef\xbc\x9a b == (a = 2)\xef\xbc\x9a"
意为:设c='w', a=1, b=2, d=-5;写出以下表达式的值:'x'+1>c, 'y'!=c+2, -a-5*b<=d+1, b==(a=2);
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)