File tree Expand file tree Collapse file tree 4 files changed +4
-12
lines changed
algorithms/sorting/bubbleSort
dataStructures/linkedList
dataStructures/linkedList Expand file tree Collapse file tree 4 files changed +4
-12
lines changed Original file line number Diff line number Diff line change 31
31
* Space:
32
32
* - O(1) since sorting is done in-place
33
33
*/
34
-
35
34
public class BubbleSort {
36
35
/**
37
36
* Sorts the given array in-place in non-decreasing order.
@@ -40,7 +39,7 @@ public class BubbleSort {
40
39
*/
41
40
public static int [] sort (int [] arr ) {
42
41
int n = arr .length ;
43
- boolean swapped ; //tracks of the presence of swaps within one iteration of the outer loop to
42
+ boolean swapped ; // tracks of the presence of swaps within one iteration of the outer loop to
44
43
// facilitate early termination
45
44
for (int i = 0 ; i < n - 1 ; i ++ ) { //outer loop which supports the invariant
46
45
swapped = false ;
Original file line number Diff line number Diff line change @@ -307,7 +307,7 @@ public String toString() {
307
307
ret += trav + " " ;
308
308
trav = trav .next ;
309
309
}
310
- return ret . substring ( 0 , ret . length ()) ;
310
+ return ret ;
311
311
}
312
312
313
313
/**
Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ public void bfs_levelOrderTraversal_shouldReturnAccurate() {
44
44
List <Integer > thirdResult = breadthFirstSearch .levelOrder (root3 );
45
45
46
46
assert firstResult .equals (firstList );
47
- System .out .println (secondResult .toString ());
47
+ // System.out.println(secondResult.toString());
48
48
assert secondResult .equals (secondList );
49
- System .out .println (thirdResult .toString ());
49
+ // System.out.println(thirdResult.toString());
50
50
assert thirdResult .equals (thirdList );
51
51
}
52
52
Original file line number Diff line number Diff line change 3
3
import org .junit .Assert ;
4
4
import org .junit .Test ;
5
5
import src .dataStructures .linkedList .LinkedList ;
6
- import src .dataStructures .linkedList .LinkedList .Node ;
7
6
8
7
public class LinkedListTest {
9
8
@ Test
@@ -42,12 +41,6 @@ public void testSearchAndGet() {
42
41
Integer test2 = ll .search (3 );
43
42
Assert .assertEquals ("3" , test2 .toString ());
44
43
45
- Node <Integer > test3 = ll .get (3 );
46
- Assert .assertEquals ("3" , test3 .toString ());
47
-
48
- Node <Integer > test4 = ll .get (10 );
49
- Assert .assertEquals (null , test4 );
50
-
51
44
Assert .assertEquals ("0 1 2 3 4 5 6 7 " , ll .toString ());
52
45
}
53
46
You can’t perform that action at this time.
0 commit comments