Possible segments of a list keeping the order the same

26 Views Asked by At

I have a sequence of elements, say for example {1, 2, 3, 4, 5}. Now I want to break this sequence in possible segments. I will have one possibility of length 5 elements which is the sequence itself. Now I will have several possibilities of length 4 elements, example: {(1, 2), 3, 4, 5} {1, (2, 3), 4, 5} etc. Now I will have several possibilities of length 4 elements, example: {(1, 2, 3), 4, 5} {(1, 2), (3, 4), 5} etc. So length wise how many possibilities can we get?

1

There are 1 best solutions below

0
On

Hint: There are four possible points to break the list. Each break can be used or not.