Data Structures and Algorithms in Java
Data Structures and Algorithms in Java
6th Edition
ISBN: 9781118771334
Author: Michael T. Goodrich
Publisher: WILEY
Question
Book Icon
Chapter 1, Problem 22C
Program Plan Intro

Strings formed by using characters

Program plan:

  • Create a class Permute that displays all the possible strings formed by using the characters.
    • In main() function,
      • Declare the required variables.
      • Create the object for the class permute.
      • Use the object to invoke the method nextLevel().
    • In nextLevel() method,
      • Use the for loop to remove the remaining letters from string and then it is inserted into partial string.
      • Call the function nextLevel().recursively to remove each letter one at a time from remainingLetters and then append it to the partial string.
      • If there are no remaining letters, partial string must be completed and convert it to a string to display it.

Blurred answer
Students have asked these similar questions
Write a java program that enables the user to enter a string and an index,then cuts the letter in the given index. And prints the new string. .
Write a java program that reads a line of input as a sentence and displays:• Only the uppercase letters in the sentence.• The sentence, with all lowercase vowels (i.e. “a”, “e”, “i”, “o”, and “u”) replaced by a strikesymbol “*”.
Write a Java program to concatenate 4 strings taken input from the keyboard and display the resultant string in the output.

Chapter 1 Solutions

Data Structures and Algorithms in Java

Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education