Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone solve question 2 for me please? StringBuffer is StringBuilder. A per

ID: 3716393 • Letter: C

Question

Can someone solve question 2 for me please?

StringBuffer is StringBuilder.

A permutation of string S is the collection of strings that can be formed using the characters from S. Example: For S = "CAT", the collection is: CAT, CTA, ACT, ATC, TAC, TCA Here, T(n) O (n!) Following is an algorithm to generate the permutations of a given string: Algorithm for PermutationGeneration Java) public static void allStart (StringBuffer s) permuteAlls, 0); public static void permuteAll (StringBuffer s, int k) if ( k = s.length?) { System.out.println(s); /count+t See Note else for ( inti-k; ?

Explanation / Answer

output:

when i=k=o there is no change in the output string, hence string will be "enjoy".

following is the first half of the output:

enjoy 1
enjyo 2
enojy 3
enoyj 4
enyoj 5
enyjo 6
ejnoy 7
ejnyo 8
ejony 9
ejoyn 10
ejyon 11
ejyno 12
eojny 13
eojyn 14
eonjy 15
eonyj 16
eoynj 17
eoyjn 18
eyjon 19
eyjno 20
eyojn 21
eyonj 22
eynoj 23
eynjo 24
nejoy 25
nejyo 26
neojy 27
neoyj 28
neyoj 29
neyjo 30
njeoy 31
njeyo 32
njoey 33
njoye 34
njyoe 35
njyeo 36
nojey 37
nojye 38
noejy 39
noeyj 40
noyej 41
noyje 42
nyjoe 43
nyjeo 44
nyoje 45
nyoej 46
nyeoj 47
nyejo 48
jneoy 49
jneyo 50
jnoey 51
jnoye 52
jnyoe 53
jnyeo 54
jenoy 55
jenyo 56
jeony 57
jeoyn 58
jeyon 59
jeyno 60