i am making an app as my own project on c#. its called Time Table Maker. the last piece of code i need to finish requires the following task to be done
We have an array of size N, where N is the TOTAL number of courses (Theory + Lab)
It is calculated by 2 variables that user gives.
We have Theory Count and Lab Count Separately
N = Theory Count + Lab Count
Now suppose N = 5;
Write a function which takes input 2 things.
1.) The Array To Permute.
2.) The char To Permute Till. Suppose (I) (eye) :v.
And it returns another Array which is permuted.
string[] PermuteOnce(string[] str, string PermuteTill)
    {
        string[] Permuted = new string[TheoryN];
        Permuted = str;
        // CODE HERE
        return Permuted;
    }
Sample Input Output;
String[5] ToPermute = {A,A,A,A,A}
Permuted = PermuteOnce(ToPermute, “I”);
Permuted now contains {A,A,A,A,B}
Calling it again and again now passing Permuted.
Permuted now contains {A,A,A,A,C}
Permuted now contains {A,A,A,A,D}
Permuted now contains {A,A,A,A,E}
Permuted now contains {A,A,A,A,F}
Permuted now contains {A,A,A,A,G}
Permuted now contains {A,A,A,A,H}
Permuted now contains {A,A,A,A,I}
Now…
Permuted now contains {A,A,A,B,A}
Permuted now contains {A,A,A,C,A}
Like this “I” is the limit to permute till.
A little more explanation….
This is what i did up till now... but does it does not work perfect...
str = PermuteOnce(str, "I");
 int Shifter = 4;
    int Count = 1;
    string ChangeTo(int C)
    {
        switch(C)
        {
            case 1:
                {
                    return "A";
                }
            case 2:
                {
                    return "B";
                }
            case 3:
                {
                    return "C";
                }
            case 4:
                {
                    return "D";
                }
            case 5:
                {
                    return "E";
                }
            case 6:
                {
                    return "F";
                }
            case 7:
                {
                    return "G";
                }
            case 8:
                {
                    return "H";
                }
            case 9:
                {
                    return "I";
                }
            default:
                return ".";
        }
    }
string[] PermuteOnce(string[] str, string PermuteTill)
    {
        string[] Permuted = new string[TheoryN];
        Permuted = str;
        char x = Convert.ToChar( Permuted[Shifter] );
        int Ascii = Convert.ToInt32(x);
        Ascii++;
        Permuted[Shifter] = Convert.ToString(Convert.ToChar(Ascii));
        if (Permuted[Shifter] == "J")
        {
            Permuted[Shifter] = ChangeTo(Count);
            if (Shifter > 0)
            Permuted[Shifter - 1] = ChangeTo(Count);
            Shifter--;
            if (Shifter == -1 && Count != 9)
            {
                Shifter = 4;
                Count++;
            }
        }
        return Permuted;
    }
Now, how will i know if my requirement is met? when one of the permutation is "AGABB". and it start from "AAAAA" and ends on "IIIII"
this is my function in which i need permutations ..
private void HRain_Click(object sender, EventArgs e)
    {
        // Set All Sections To A In The Start.
        for (int i = 0; i < TheoryN; i++) { Sections[i].Text = Convert.ToString(Convert.ToChar(65)); } 
        // Clear Display Screen / Allocate Query And str for processing.
        Result_Screen_L.Clear();
        Query = new string[TotalCourses];
        string[] str = new string[TheoryN];
        // Loop Should Run Untill All Permutations Are Printed. e.g (From 'AAAAA' , 'IIIII' is attained.)
        while (!(Sections[0].Text == "I" && Sections[1].Text == "I" && Sections[2].Text == "I" && Sections[3].Text == "I" && Sections[4].Text == "I"))
        {
            for (int i = 0; i < TheoryN; i++) { str[i] = Sections[i].Text.ToString(); } // move sections to str.
            MatchWithLabs(); // magic logic in this.
            for (int i = 0; i < TotalCourses; i++) { Query[i] = CourseName[i].Text + " (" + Sections[i].Text + ")"; } // set query to calculate timetable.
            //Result = new string[MaxItems * MaxItems]; // to store result in. 7*7.
            //CalculateTimeTable(); // magic here too.
            //if (CheckForClash(Result)) DisplayResultScreen(); // if no clash then print on screen <3.
            str = PermuteOnce(str, "I"); // your magic function.
            //rev = new Revision("ABCDEFGHI", "AAAAA");
            for (int i = 0; i < TheoryN; i++) { Sections[i].Text = Convert.ToString(str[i]); } // move permuted str back to Sections.
        }
    }