Skip to content

Commit 1c56c2b

Browse files
committed
random
1 parent 0b0a9d4 commit 1c56c2b

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

array/sorting/MergeSort.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package array.sorting;
22

3+
import java.util.ArrayList;
34
import java.util.Arrays;
45

56
public class MergeSort {
@@ -16,18 +17,18 @@ static int[] mergeSort(int[] array){
1617
return merge(left, right );
1718
}
1819

19-
static int[] merge(int[] first, int[] second) {
20+
static int[] merge(int[] first, int[] second) {
2021
int[] mix = new int[first.length + second.length];
2122

2223
int i = 0;
2324
int j = 0;
2425
int k = 0;
2526

2627
while (i < first.length && j < second.length) {
27-
if (first[i] < second[j]){
28+
if (first[i] < second[j]) {
2829
mix[k] = first[i];
2930
i++;
30-
}else {
31+
} else {
3132
mix[k] = second[j];
3233
}
3334
k++;
@@ -49,4 +50,5 @@ static int[] merge(int[] first, int[] second) {
4950

5051
return mix;
5152
}
53+
5254
}

collectionFramework/IteratorS.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,20 @@ public static void main(String[] args) {
1717
// display using iterator
1818
Iterator<String> itr = list.iterator();
1919

20+
System.out.println("Display using iterator : ");
2021
while (itr.hasNext()) {
2122
String item = itr.next();
22-
System.out.println(item + " ");
23+
System.out.print(item + " ");
2324
}
2425

26+
System.out.println();
2527
// modify using iterator
2628
ListIterator<String> lsItr = list.listIterator();
2729

30+
System.out.println("Modify using iterator : ");
2831
while (lsItr.hasNext()) {
2932
String item = lsItr.next();
30-
System.out.println(item + " ");
33+
System.out.print(item + " ");
3134
}
3235

3336
}

collectionFramework/LL.java renamed to linkedList/collectionFramework/LL.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package collectionFramework;
1+
package linkedList.collectionFramework;
22

33
import java.util.LinkedList;
44

0 commit comments

Comments
 (0)