问题描述
我对子数组,子序列&子集
I'm a bit confused between subarray, subsequence & subset
如果我有{1,2,3,4}
然后
子序列可以是{1,2,4}
或{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}
那子集是什么?
我对这三个感到有些困惑.
I'm bit confused between these 3.
推荐答案
在我看来,如果给定的模式是数组,则所谓的subarray
表示contiguous subsequence
.
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.
这篇关于子数组,子集和内容之间的差异子序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!