Question: THIS IS A JAVA PROGRAM Implement a SubsetGenerator class that generates all subsets of the characters of a string. For example, the subsets of the

THIS IS A JAVA PROGRAM

Implement a SubsetGenerator class that generates all subsets of the characters of a string. For example, the subsets of the characters of the string run are the eight strings run, ru, rn, r, un, u, n, and . Note the subsets do not have to be substrings for example, rn is not a substring of run. You are to include a recursive method to find the subsets. Use the following SubsetGeneratorTester class to test your program. You should test your program with another string as well. You may not use a helper method. You may only have one instance field in the class word.

import java.util.Collections; import java.util.ArrayList; import java.util.List; /** This program tests the subset generator. */ public class SubsetGeneratorTester { public static void main(String[] args) { SubsetGenerator generator = new SubsetGenerator("run"); List subsets = generator.getSubsets(); // Sort the result for checking Collections.sort(subsets); System.out.println(subsets); System.out.println("Expected: [, n, r, rn, ru, run, u, un]"); } } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!