I wrote an sort algorithm to test the speed, but the 100 x W has exceeded the 32-bit limit. The 32-bit PC should be the power of 2, I hope a friend with a 64-bit CPU can test it. Of course, don't forget to tell me the result.
Import java. util .*;
Class dumbsort {
Public static void main (string [] ARGs ){
Final int F1 = 100000;
Int [] A = new int [F1];
Int I = 0;
Random Rand = new random ();
For (; I <A. length; I ++)
{
A [I] = Rand. nextint (1000000 );
}
Int innerloop = 0;
Int outerloop = 0;
Int swaps = 0;
For (I = 0; I <A. length; I ++ ){
Outerloop ++;
For (Int J = 1; j <A. length; j ++ ){
Innerloop ++;
If (A [J-1]> A [J]) {
Int temp = A [J-1];
A [J-1] = A [J];
A [J] = temp;
SWAps ++;
}
}
}
For (I = 0; I <A. length; I ++)
System. Out. Print (A [I] + "/N ");
System. Out. println ();
System. Out. println ("outer loop executed" + outerloop + "Times .");
System. Out. println ("inner loop executed" + innerloop + "Times .");
System. Out. println (SWAPs + "swaps completed .");
}
}