better handling of empty if/else blocks
This commit is contained in:
@@ -30,6 +30,8 @@ public class Quicksort {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
// Sample data
|
||||
int[] a = new int[100000000];
|
||||
for (int i = 0; i < a.length; i++) {
|
||||
@@ -38,8 +40,6 @@ public class Quicksort {
|
||||
a[i] = -a[i];
|
||||
}
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
quicksort(a);
|
||||
|
||||
long total = System.currentTimeMillis() - start;
|
||||
|
||||
@@ -17,7 +17,7 @@ fun IntArray.quicksort(L: Int, R:Int) {
|
||||
i++
|
||||
while (this[j] > m)
|
||||
j--
|
||||
if (i <= j) { KT-5
|
||||
if (i <= j) {
|
||||
swap(i++, j--)
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@ fun IntArray.quicksort(L: Int, R:Int) {
|
||||
}
|
||||
|
||||
fun main(array: Array<String>) {
|
||||
val start = System.currentTimeMillis()
|
||||
|
||||
val a = IntArray(100000000)
|
||||
var i = 0
|
||||
val len = a.size
|
||||
@@ -38,8 +40,6 @@ fun main(array: Array<String>) {
|
||||
i++
|
||||
}
|
||||
|
||||
val start = System.currentTimeMillis()
|
||||
|
||||
a.quicksort()
|
||||
|
||||
val total = System.currentTimeMillis() - start
|
||||
|
||||
Reference in New Issue
Block a user