
#1
Feb2212, 11:39 PM

P: 14

Use nested for loops to produce the following pattern of cyclic permutations of the English
alphabet: abcde......yz bcdef......za cdef......zab ... zabcde......xy HINT: you may find the modulo (remainder) operator % useful. I have an idea of how to do this but it would not use the modulo operator. I thought of saving the first letter of an array into a variable, shifting everything else down one and putting it at the end. This also would only implement a single for loop. Any clues would be greatly appreciated. 



#2
Feb2312, 12:09 AM

P: 329

Yes, there are probably a million ways to do this, but I suggest that you have one loop generating the first character of each string and an inner loop (since that what was asked for) generating the successive letters of each string  using modulo operator to make the wrap from z to a.




#3
Feb2312, 11:13 AM

P: 14

Thanks a lot. Took me a bit to get the wrap around to work properly but I got it. I don't think modulo was very intuitive to me before but now I get it.



Register to reply 
Related Discussions  
prove product of infinite cyclic groups not an infinite cyclic group  Calculus & Beyond Homework  3  
Lagrangian formalism: cyclic coordinates. Why "cyclic"? Where's the term come from?  Classical Physics  0  
Conjugation of a permutation by a permutation in a permutation group  Calculus & Beyond Homework  3  
Permutation  Precalculus Mathematics Homework  1  
Differentiate between cyclic and non cyclic phosphorilation in photosynthesis?  Biology  0 