I need an algorithm who can create strings which are like

a
...
...
z
aa
....
...
za
ab
....
...
zb
ac
...
zz
aaa
....
.....

like a brute force.

Do you know the name of this algorithm, so i can search through the net for an optimized version?

I made such an algorithm, but i think it is slow, so i'm searhing for an optimized version.

2. How bout posting your code so we can give you some optimization tips?

3. I am rewriting it, I think tomorroe (3-15-2003) I'll post what I coded

4. Here it is:

Code:
```	int i;
//	char charset[] = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char CharSet[] = "abc";
char string[50];
int PosCharSet[50]; // for every character of the string it is a "pointer" to the letter of the charset

min = 0;
max = sizeof (CharSet) - 2;

memset (&string, 0, sizeof (string));

for (i = 0; i < 50; i++)
PosCharSet[i] = 1;

for (;;)
{
for (i = min; i <= max; i++)
{
string[0] = CharSet[i];
printf (string);
}

i = 1;

while (string[i] == CharSet[max])
{
string[i] = CharSet[min];
PosCharSet[i] = 1;
i++;
}

if (string[i] == NULL)
{
string[i] = CharSet[min];
PosCharSet[i] = 1;
}
else
{
string[i] = CharSet[PosCharSet[i]];
PosCharSet[i]++;
}```
Tell me what you think about it, and if you know another way to make it, tell me, I don't want an optimized version of my algorithm only, if there is a different algorithm, which does what I need and it is faster, write it

Thank you for your help, waste of time and patience

5. Here's some code which may do what you want. Change MAX_LEN for the code length i.e. MAX_LEN 3 will give 'a' to 'zzz'
Code:
```#include <stdio.h>

int GetNextCode(char* c, int max)
{
for(int i = 0; i < max; i++)
{
if(!c[i])
{
c[i] = 'a';
return 1;
}

if( c[i] < 'z' )
{
c[i]++;
return 1;
}
else
c[i] = 'a';
}
return 0;
}

#define MAX_LEN 3
int main()
{
char code[MAX_LEN + 1] = {0};

while( GetNextCode(code, MAX_LEN) )
printf("%s ", code);

return 0;
}```

6. hank you very much for your help guys