mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 06:55:02 +08:00
Format code with prettier (#3375)
This commit is contained in:
@ -66,7 +66,8 @@ public class BFPRT {
|
||||
int offset = num % 5 == 0 ? 0 : 1;
|
||||
int[] mArr = new int[num / 5 + offset];
|
||||
for (int i = 0; i < mArr.length; i++) {
|
||||
mArr[i] = getMedian(arr, begin + i * 5, Math.min(end, begin + i * 5 + 4));
|
||||
mArr[i] =
|
||||
getMedian(arr, begin + i * 5, Math.min(end, begin + i * 5 + 4));
|
||||
}
|
||||
return bfprt(mArr, 0, mArr.length - 1, mArr.length / 2);
|
||||
}
|
||||
@ -119,7 +120,27 @@ public class BFPRT {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int[] arr = {11, 9, 1, 3, 9, 2, 2, 5, 6, 5, 3, 5, 9, 7, 2, 5, 5, 1, 9};
|
||||
int[] arr = {
|
||||
11,
|
||||
9,
|
||||
1,
|
||||
3,
|
||||
9,
|
||||
2,
|
||||
2,
|
||||
5,
|
||||
6,
|
||||
5,
|
||||
3,
|
||||
5,
|
||||
9,
|
||||
7,
|
||||
2,
|
||||
5,
|
||||
5,
|
||||
1,
|
||||
9,
|
||||
};
|
||||
int[] minK = getMinKNumsByBFPRT(arr, 5);
|
||||
System.out.println(Arrays.toString(minK));
|
||||
}
|
||||
|
Reference in New Issue
Block a user