子数组,子集和之间的区别子序列 [英] Difference between subarray, subset & subsequence

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

问题描述

我对子数组、子序列和;子集

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.

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆