Method
subset
(String s, int i, int n, String a)
Source from the content-addressed store, hash-verified
| 2 | class Subset_gen // Same as generating all the subsequence of a string |
| 3 | { // Produces 2^N outputs |
| 4 | static void subset(String s, int i, int n, String a) // Same thing you have to follow that at a time, u can either choose a character or leave it |
| 5 | { |
| 6 | if (i == n) |
| 7 | { |
| 8 | System.out.println(a); |
| 9 | return; |
| 10 | } |
| 11 | subset(s, i + 1, n, a + s.charAt(i)); |
| 12 | subset(s, i + 1, n, a); |
| 13 | } |
| 14 | |
| 15 | public static void main(String args[]) |
| 16 | { |
Tested by
no test coverage detected