I am trying to figure out how to get the sub-sequences of
{0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15};
I managed to find examples on how to get the length of a longest increasing sub-sequence. I have been trying to adapt the code to get which values actually make up the length.
The sequences I need in a array are: [0, 2, 6, 9, 13, 15] or [0, 4, 6, 9, 11, 15] or [0, 4, 6, 9, 13, 15]
My approach:
I pass the array in as a parameter(a), then I create a new array of the same size(s).
s[0] = a[0];
Then I used two loops
for (int i = 1; i < a.length; i++) {
for (int j = 0; j < i; j++) {
After that I ran a simple comparison:
if (a[j] < a[i])
My logic pretty much ends here because I do not know what else I can do. I do not mind pseudo-code at all.