# Recursively finding n word permutations given a linked-list of strings in C?

I'm having trouble creating a recursive algorithm to find the number of n word permutations given a linked list of strings.

So, the function should take the linked list of strings and output a linked list of all possible concatenated permutations of those strings, separated by spaces.

Essentially, if the linked list was say ("cat", "dog", "mouse"), and n was 3, it should return: "cat dog mouse", "cat mouse dog", "dog cat mouse", "dog mouse cat", "mouse cat dog", and "mouse dog cat".

Similarly, if n was 2, it should return: "cat dog", "cat mouse", "dog cat", "dog mouse", "mouse cat", and "mouse dog".

I can't seem to figure out a solution.

Hello and welcome to SO. While we are always anxious to help someone with a programming problem, we like to see what the person has already tried and what isn't working so that we are in a better position to provide an answer as well as to prevent us offering suggestions that have already been tried and aren't working. With that in mind, could you post the code you have already tried and show us where it seems to be going wrong? This link will help to explain this concept in more detail - idownvotedbecau.se/noattempt

### 1 Answer

Recursion involves finding an inductive case and a base case. The inductive case takes you one step closer to the solution, while the base case solves a small version of the problem.

In this case, your **base case** is "find all permutations of a list with one element." There is only one value in this set, the string itself.

A great candidate for your **inductive case** would be "for each string in the set, return the concatenation of that string with each of the permutations of the set without that string".

Any

attempts, at least? Also, are the words guaranteed to be unique?