Use the following method to generate an array (arr1) of 5000 randomly generated elements.
public static int[] RandomArrayGenerator(int n)
{
int[] Array = new int[n];
Random r = new Random();
for(int i=0;i<>
Array[i] = r.nextInt(1000);
}
return Array;
[Note that by using nextInt(100) you will generate an integer between 0 and 100.]
long startTime = System.currentTimeMillis();
//call sort method here
long endTime = System.currentTimeMillis();
Include a screenshot of the code and the output.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here