|Feb22-12, 11:39 PM||#1|
Cyclic Permutation in C
Use nested for loops to produce the following pattern of cyclic permutations of the English
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.
|Feb23-12, 12:09 AM||#2|
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.
|Feb23-12, 11:13 AM||#3|
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.
|Similar Threads for: Cyclic Permutation in C|
|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|