Click here to load reader
Upload
hanis-salwan
View
83
Download
4
Embed Size (px)
Citation preview
2. Problem Find a sorted list of element in non- decreasing order. Elements can be in positive or negative integers. 3. The Decomposition Technique and Mapping Technique Used Recursive decomposition technique was implemented to solve this problem. Merge sort apply a divide and conquer algorithm. Merge sort work by dividing the unsorted list into n sublists, each having 1 element. Repeatedly ,merge sublists to produce a new sublists until there is only 1 sublist remaining. Mapping Technique: Since this is a serial program, no mapping technique used. 4. The Program Structurejava import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Iterator; public class MergeSort { public static int[] mergeSort(int [] list) { if (list.length