1. For Q1.

You could use Two-Dimensional Array to implement it, see the sample.

2. For Q2.

Suppose you input a string,

Function REC(string)

{
Using an array Str[]  to store the string,
output
{Str[0], Str[1]}, {Str[0], Str[2]},{Str[0], Str[3]},{Str[0], Str[4]}, ......{Str[0], Str[N]}.

if(string.length !=0)
{
delete the first element in the string,
REC(string)
}
}