Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.
import java.util.Random;
public class Test {
static int arr[] = new int[30000];
public static void bubbleSort(int[] x) {
int n = x.length;
for (int pass=1; pass < n; pass++) {
for (int i=0; i < n-pass; i++) {
if (x[i] > x[i+1]) {
int temp = x[i]; x[i] = x[i+1]; x[i+1] = temp;
}
}
}
}
public static void main(String... args) {
Random r = new Random(123456L); // use the seed 123456
for (int i = 0 ; i < 30000; i++) {
arr[i] = r.nextInt(20);
}
bubbleSort(arr);
for (int i = 0 ; i <= 10; i++) {
System.out.println(" " + i + " element is " + arr[i]);
}
}
}
import java.util.Random;
public class Q26408241 {
static double arr[] = new double[30000];
public static void bubbleSort(double[] x) {
int n = x.length;
for (int pass = 1; pass < n; pass++) {
for (int i = 0; i < n - pass; i++) {
if (x[i] < x[i + 1]) {
double temp = x[i];
x[i] = x[i + 1];
x[i + 1] = temp;
}
}
}
}
public static void main(String... args) {
Random r = new Random(123456L); // use the seed 123456
for (int i = 0; i < 30000; i++) {
arr[i] = r.nextDouble()*20;
}
bubbleSort(arr);
for (int i = 0; i < 10; i++) {
System.out.println(" " + i + " element is " + arr[i]);
}
}
}
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.