Need help with logic algorithm...
This is an assignment but I'm not stumped by the coding of it. I'm stumped by the logical algorithm I've tried several approaches and none of them are working.
The premise is this allow the user to input a word and then output all permutations of the word in which the first letter stays in it's default position. Also we cannot use string objects only arrays of chars.
i.e. word would output:
word wodr wdor wrod wdro wrdo
The parts of the approach I'm sure are correct are:
Get user input and store in an Array(inputArray).
Store first letter of user input in a variable(firstLetter).
Store initial word in an Array(outputArray).
Remove First Letter of input from inputArray).
Shuffle remaining members of the inputArray
Store firstLetter concatenated with inputArray as a new member of outputArray.
My issue is figuring out how to shuffle the remaining inputArray characters and only arrive at the remaining permutations.
I tried dynamically refering to indexes of characters based on incrementation and the length of inputArray and couldn't get it to work.
I tried simply rotating the position of each letter forward in a loop but this results in only a few of the permutations.