Generation

generate functionSun, 15 Jan 2023

how to find the subsequences of an array

void subsequence(char *in, char *out, int i, int j) { // Base Case if (in[i] == '\0') { out[j] = '\0'; cout << out << endl; return; } // Recursive Case // include the ith character out[j] = in[i]; subsequence(in, out, i + 1, j + 1); subsequence(in, out, i + 1, j); }

Questions about programming?Chat with your personal AI assistant