本文介绍了子数组,子集和内容之间的差异子序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对子数组,子序列&子集

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.

这篇关于子数组,子集和内容之间的差异子序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 03:39