Question
For this assignment you must write the following functions using recursion: //Class A8Utils: // Print out 'n' *'s on the same line printStars(int n); //
For this assignment you must write the following functions using recursion:
//Class A8Utils:
// Print out 'n' *'s on the same line
printStars(int n);
// Return the minimum of the array
min(int[] numbers));
// Return Yes if pattern is found in target, No otherwise
isIn(String pattern, String target);
// Print all the permutations of word
permutations(String word);
// Return the number of permutations of word
countNumberOfPerms(word);
//main:
public class A8 { public static void main(String[] args) { A8Utils utils = new A8Utils(); utils.printStars(0); utils.printStars(5); int[] numbers = { 41, 0, 74, -1, 8, 37, 79, 5, 22, -17 }; System.out.println("Minumum is " + utils.min(numbers)); String[] patterns = { "al ", "Sta", "eat", "eac" }; for(int ii = 0; ii < patterns.length; ++ii) { System.out.println("Is pattern '" + patterns[ii] + "' in 'Cal State Long Beach'? " + utils.isIn(patterns[ii], "Cal State Long Beach")); } utils.permutations("1234"); utils.permutations("ios"); utils.countNumberOfPerms("LongBeach"); } }
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