MCPcopy Create free account
hub / github.com/chaharnishant11/CodeIn10DSA / sequence

Method sequence

Recursion/Code/Subsequences.java:7–21  ·  view source on GitHub ↗
(String s, String temp, int index)

Source from the content-addressed store, hash-verified

5
6class HelloWorld {
7 public static void sequence(String s, String temp, int index){
8
9 if (s.length()==index){ //Base Case
10 System.out.print(temp+" ");
11 return;
12 }
13
14 // take
15 String X = temp.concat(String.valueOf(s.charAt(index)));
16 sequence(s,X,index+1);
17
18 // not take
19 sequence(s,temp,index+1);
20
21 }
22public static void main(String[] args) {
23 Scanner sc= new Scanner(System.in);
24 System.out.print("Enter a string: ");

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected