MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / subset

Method subset

Java/Recursion/Subset_gen.java:4–13  ·  view source on GitHub ↗
(String s, int i, int n, String a)

Source from the content-addressed store, hash-verified

2class 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 {

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected