Q. Program to find all possible subsets of a string.ExplanationIn this program, all the subsets of the string need to be printed. The subset of a string is the character or the group of characters that are present inside the string. For example, all possible subsets of a string "FUN" will be F, U, N, FU, UN, FUN. To complete this program, We need to run two for loops. The outer loop is used to maintain the relative position of the first character and the second loop is used to create all possible subsets and prints them one by one. The algorithm of the program is given below. Algorithm
SolutionPythonOutput: All subsets for given string are: A AB ABC B BC C COutput: All subsets for given string are: A AB ABC B BC C JAVAOutput: All subsets for given string are: A AB ABC B BC C C#Output: All subsets for given string are: A AB ABC B BC C PHPOutput: All subsets for given string are: A AB ABC B BC C Next TopicPrograms List |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India