214k views
5 votes
Determine whether each of the subsequences w given in the previous question are contiguous subsequences of the following sequences s. -

a. s=<{1,2,3,4,5,6}{1,2,3,4,5,6}{1,2,3,4,5,6}>
b. s=<{1,2,3,4}{1,2,3,4,5,6}{3,4,5,6}>
c. s=<{1,2}{1,2,3,4}{3,4,5,6}{5,6}>
d. s=<{1,2,3}{2,3,4,5}{4,5,6}>

1 Answer

5 votes

a. Yes, w={1,2,3,4,5,6} is contiguous in s.

b. Yes, both w={1,2,3,4} and w={3,4,5,6} are contiguous in s.

c. Yes, both w={1,2} and w={3,4,5,6} are contiguous in s.

d. No, w={1,2,3} is not contiguous in s, but both w={2,3,4,5} and w={4,5,6} are contiguous in s.

In order to determine whether each of the given subsequences (w) is a contiguous subsequence of the respective sequences (s), we need to examine the structure and arrangement of elements in each case.

a. s={1,2,3,4,5,6}

The subsequence w={1,2,3,4,5,6} is contiguous in s because it appears in the exact order without any elements missing or additional elements.

b. s={1,2,3,4}{1,2,3,4,5,6}{3,4,5,6}

The subsequence w={1,2,3,4} is contiguous in s since it appears in the beginning without interruption.

However, w={3,4,5,6} is also contiguous in s because it starts at index 9 and continues without any gaps.

c. s={1,2}{1,2,3,4}{3,4,5,6}{5,6}

Both w={1,2} and w={3,4,5,6} are contiguous in s as they appear without breaks or extra elements.

d. s={1,2,3}{2,3,4,5}{4,5,6}

The subsequence w={1,2,3} is not contiguous in s because there is a gap between the first and second sets.

The subsequences w={2,3,4,5} and w={4,5,6} are contiguous in s.

User Ahmed Nawaz
by
7.8k points