Difference between subarray, subset & subsequence

user2821242 picture user2821242 · Oct 26, 2014 · Viewed 19.5k times · Source

I'm a bit confused between subarray, subsequence & subset

if I have {1,2,3,4}

then

subsequence can be {1,2,4} OR {2,4} etc. So basically I can omit some elements but keep the order.

subarray would be( say subarray of size 3)

{1,2,3}
{2,3,4} 

Then what would be the subset?

I'm bit confused between these 3.

Answer

Wilson picture Wilson · May 17, 2015

In my opinion, if the given pattern is array, the so called subarray means contiguous subsequence.

For example, if given {1, 2, 3, 4}, subarray can be

{1, 2, 3}
{2, 3, 4}
etc.

While the given pattern is a sequence, subsequence contain elements whose subscripts are increasing in the original sequence.

For example, also {1, 2, 3, 4}, subsequence can be

{1, 3}
{1,4}
etc.

While the given pattern is a set, subset contain any possible combinations of original set.

For example, {1, 2, 3, 4}, subset can be

{1}
{2}
{3}
{4}
{1, 2}
{1, 3}
{1, 4}
{2, 3}
etc.