The problem I am trying to solve in Java requires dividing an input array into all allowable subsequences, where an allowable subsequence contains only consecutive values. For example, I would like {A,E,D} to return {A,E,D},{A,E},{A},{E,D},{D},{E}
This is different from this question in that (for above example)
1) I have the 'consecutive value' rule that means {A,D} is NOT allowed and
2) I cannot depend on the Python syntax in the answers here.
My question, in particular, is how to implement the 'consecutive value' rule to the more general subsequence problem.
So far, I have come up with one algorithm for the example {1,2,3}:
1. Copy {1,2,3} and store in arr
2. Append {1,2,3} to solutions, peel off 3
3. Append {1,2} to solutions, peel off 2
4. Append {1} to solutions. Cut 1 from arr
5. Append {2,3} to solutions peel off 3
6. Append {2} to solutions. Cut 2 from arr
7. Append {3} to solutions