Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement a SubsetGenerator that generates all subsets of the characters of a string. For example, the subsets of the characters of the string rum are
Implement a SubsetGenerator that generates all subsets of the characters of a string. For example, the subsets of the characters of the string "rum" are the eight strings "rum", "ru", "rm", "r", "um", "u", "m", "" Note that the subsets don't have to be substringsfor example, "rm" isn't a substring of "rum".
You need to supply the following class in your solution:
SubsetGenerator
Use the following class as your tester class:
import java.util.Collections; import java.util.ArrayList; /** This program tests the subset generator. */ public class SubsetGeneratorTester { public static void main(String[] args) { SubsetGenerator generator = new SubsetGenerator("rum"); ArrayListsubsets = generator.getSubsets(); // Sort the result for checking Collections.sort(subsets); System.out.println(subsets); System.out.println("Expected: [, m, r, rm, ru, rum, u, um]"); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started