File tree 1 file changed +2
-4
lines changed
src/main/java/com/thealgorithms/sorts
1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ private static <T extends Comparable<T>> List<List<T>> formPiles(final T[] array
47
47
for (T x : array ) {
48
48
int pos = Collections .binarySearch (lastElements , x );
49
49
if (pos < 0 ) {
50
- pos = ~ pos ; // bitwise complement, which is equivalent to ( -pos - 1)
50
+ pos = -pos - 1 ;
51
51
}
52
52
53
53
if (pos < piles .size ()) {
@@ -75,9 +75,7 @@ private static <T extends Comparable<T>> List<List<T>> formPiles(final T[] array
75
75
private static <T extends Comparable <T >> PriorityQueue <PileNode <T >> mergePiles (final List <List <T >> piles ) {
76
76
PriorityQueue <PileNode <T >> pq = new PriorityQueue <>();
77
77
for (List <T > pile : piles ) {
78
- if (!pile .isEmpty ()) {
79
- pq .add (new PileNode <>(pile .removeLast (), pile ));
80
- }
78
+ pq .add (new PileNode <>(pile .removeLast (), pile ));
81
79
}
82
80
return pq ;
83
81
}
You can’t perform that action at this time.
0 commit comments