fix bubble sort
This commit is contained in:
parent
c26630f046
commit
7bd608207c
|
@ -7,7 +7,7 @@ public class BubbleSort {
|
|||
void bubbleSort(Integer[] arr) {
|
||||
int n = arr.length;
|
||||
IntStream.range(0, n - 1)
|
||||
.flatMap(i -> IntStream.range(i + 1, n - i))
|
||||
.flatMap(i -> IntStream.range(1, n - i))
|
||||
.forEach(j -> {
|
||||
if (arr[j - 1] > arr[j]) {
|
||||
int temp = arr[j];
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.baeldung.algorithms.bubblesort;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class BubbleSortUnitTest {
|
||||
|
||||
|
|
Loading…
Reference in New Issue