Learn to indent properly your code, it show its structure and it helps reading and understanding. It also helps spotting structures mistakes.
int x[] = { 123 , 999 , 456 , 3432 , 12 , 43 , 9 , 67 , 9000 , 12345 , 45678 , 789 , 765 , 321 } ;
int x1[] = { 123 , 999 , 456 , 3432 , 12 , 43 , 9 , 67 , 9000 , 12345 , 45678 , 789 , 765 , 321 } ;
for ( int i=0 ; i<=4 ; i++ )
{
int c=0 ;
for ( int k=0 ; k<10 ;k++)
{
for ( int a=0 ; a<x.length ; a++ )
{
if ( ( x1[a] / ( (int)( Math.pow(10,i) ) ) ) %10 == k )
{
x[c] = x1[a] ;
System.out.println(x[c] + " " + c );
c++ ;
}
}
}
for ( int u=0 ; u<x1.length ; u++ )
{
x1[u] = x[u] ;
}
}
Professional programmer's editors have this feature and others ones such as parenthesis matching and syntax highlighting.
Notepad++ Home[
^]
ultraedit[
^]
Quote:
Is it a good algorithm and what kind of sort is it ?
It look like a radix sort but highly inefficient.