问题描述
我对子数组、子序列和;子集
I'm a bit confused between subarray, subsequence & subset
如果我有 {1,2,3,4}
然后
subsequence 可以是 {1,2,4}
OR {2,4}
等等.所以基本上我可以省略一些元素但保持顺序.
subsequence can be {1,2,4}
OR {2,4}
etc. So basically I can omit some elements but keep the order.
子数组将是(比如大小为 3 的子数组)
subarray would be( say subarray of size 3)
{1,2,3}
{2,3,4}
那么子集是什么?
我对这三个有点困惑.
推荐答案
在我看来,如果给定的模式是数组,那么所谓的subarray
就是连续子序列
.
In my opinion, if the given pattern is array, the so called subarray
means contiguous subsequence
.
例如,如果给定{1, 2, 3, 4},subarray
可以是
For example, if given {1, 2, 3, 4}, subarray
can be
{1, 2, 3}
{2, 3, 4}
etc.
虽然给定的模式是一个序列,但 subsequence
包含其下标在原始序列中递增的元素.
While the given pattern is a sequence, subsequence
contain elements whose subscripts are increasing in the original sequence.
例如{1, 2, 3, 4},subsequence
也可以
For example, also {1, 2, 3, 4}, subsequence
can be
{1, 3}
{1,4}
etc.
虽然给定的模式是一个集合,subset
包含原始集合的任何可能组合.
While the given pattern is a set, subset
contain any possible combinations of original set.
例如{1, 2, 3, 4},subset
可以是
For example, {1, 2, 3, 4}, subset
can be
{1}
{2}
{3}
{4}
{1, 2}
{1, 3}
{1, 4}
{2, 3}
etc.
这篇关于子数组,子集和之间的区别子序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!