We help IT Professionals succeed at work.

3 Character  Permutation Algorithm

searchei
searchei asked
on
1,080 Views
Last Modified: 2008-05-05
I am trying to figure out how to do what I think is a permutation.  I need to develop an algorithm to calculate all the different possibilities of a 3 character in length string with containing the characters 0-9 and A-Z in each of the 3 positions.  For instance like the following.  (I hope you get the gist of what I need)

A00  A10   A11            B00  0A0
A01  A20   A12            B01  0B0
A02...A30.. A13.........  B02   0C0

But all the different sequences of 36 characters 0-9 A-Z

Comment
Watch Question

Ted BouskillSenior Software Developer
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Ted BouskillSenior Software Developer
CERTIFIED EXPERT
Top Expert 2009

Commented:
Oops there was a typo (36 ^ 3) = 46656
ozo
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2015

Commented:
It sounds like you want to count to 36 in 3 nested loops
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
OK, Thanks.  Here's a bonus for you if you want to do this with a string:

int main(int argc, char *argv[])
{
    int i,j,k;

    char list[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    char string_result[4];

    string_result[3]=0;         /* NUL terminate the string */

    for (i=0; i<36; i++)
    {
        string_result[0]=list[i];               /* Set x__ */
        for (j=0; j<36; j++)
        {
            string_result[1]=list[j];           /* Set _y_ */
            for (k=0; k<36; k++)
            {
                string_result[2]=list[k];       /* Set __z */
                printf("%s\n",string_result);   /* Print xyz */
            }
        }
    }
    return 0;
}

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.