public static void Main(string[] args) { int?[] arr1 = new int?[] { 1, 5, 6, 9, 21 }; int?[] arr2 = new int?[] { 4, 6, 11, 14 }; int?[] arr3 = new int?[] { -1, 0, 7 }; int?[] arr4 = new int?[] { -4, -2, 11, 14, 18 }; int?[] arr5 = new int?[] { 2, 6 }; int?[] arr6 = new int?[] { -5, -2, 1, 5, 7, 11, 14 }; int?[] arr7 = new int?[] { -6, -1, 0, 15, 17, 22, 24 }; IList <int?> list1 = Arrays.asList(arr1); IList <int?> list2 = Arrays.asList(arr2); IList <int?> list3 = Arrays.asList(arr3); IList <int?> list4 = Arrays.asList(arr4); IList <int?> list5 = Arrays.asList(arr5); IList <int?> list6 = Arrays.asList(arr6); IList <int?> list7 = Arrays.asList(arr7); IList <IList <int?> > chunks = new List <IList <int?> >(); chunks.Add(list1); chunks.Add(list2); chunks.Add(list3); chunks.Add(list4); chunks.Add(list5); chunks.Add(list6); chunks.Add(list7); ChunkMerge cm = new ChunkMerge(); IList <int?> result = cm.mergeChunksOfDifferentSize(chunks); Console.WriteLine(result.Count); foreach (int?r in result) { Console.Write(r + " "); } result = cm.mergeUsingHeap(chunks); Console.WriteLine(); foreach (int?r in result) { Console.Write(r + " "); } }
public Triplet(ChunkMerge outerInstance) { this.outerInstance = outerInstance; }