2>
8. (5 points) Trace merge sort algorithm as it sorts the following sequence of integer array into...
6. (10 points) Trace insertion sort algorithm as it sorts the following sequence of integer array into an ascending order. 17 3 12
16. (5 points) Trace counting sort algorithm as it sorts the array into a descending order. ASSUMPTION: (1) Each data element (i.e., aſil) is associated with a complicated object. As discussed, counting sort with a simple frequency count does not work. (2) Show how to guaranted the stability of repeating values. As we did in the class, please use a subscript to specify the order of the same keved values. (3) Show the steps as detail as possible. A =...
Please come up with an array of 9 random integers then sort the array. Show the contents of the array each time a sorting algorithm changes it while sorting the array into ascending order. The 6 sorting algorithm we are using are: 1. Selection Sort 3 points 2. Insertion Sort 3 points 3. Shell Sort 6 points 4. Bubble Sort 3 points 5. Merge Sort 10 points 6. Quick Sort 10 points It is OK to do this assignment on...
Sort the same array [3, 5, 1, 4, 8, 7,9, 2] in the ascending order by applying the Merge sort algorithm. Write down the intermediate results step by step in a tree structure. (20 points)
Java - Data Structures Q. Implement one of the sorts ( Selection Sort / Insertion Sort / Shell Sort / Merge Sort ) described in Chapters 8 and 9 . Input is an array with at least 10 items. The items can be of any type (Suggested types are integers—denoting how many patrons visited the library in the last three weeks or strings—denoting the names of books returned today). Print the original data. Print the sorted data.
5. [30 pts.] Sorting: Fundamentals (a) [10 pts.] llustrate the performance of the merge-sort algorithm by providing the merge- sort tree T corresponding to (1) the input sequence processed and (2) the output sequence generated based on the following input sequence: (20, 17,5,9, 19,40, 60, 11) i. Phase 1: input sequences processed at each node of T ii. Phase 2: output sequences generated at each node of T We were unable to transcribe this image(c) [10 pts.] Illustrate the performance...
Radix sort C++ Come up with an unsorted array of numbers (integer array). Sort the numbers in ascending order and descending order and display them using radix sort. First sort in ascending, then reset the array to its original order and finally sort the array again in descending order. USE THIS STUCTURE struct nodeQ{ node *front; node *rear; }; nodeQ que[10]; enqueue(que[i],data); EXAMPLE: Original, unsorted list: [170, 45, 75, 90, 2, 802, 24, 66] 1ST PASS:...
Sorting Sort the following array using the quick sort algorithm: (4 Marks) a. 12 26 8 9 7 0 4 Pivot selection is defined to be the first element of each sub-list. Show the array before and after each quicksort round (when the array is partitioned after placing the pivot at its correct position). Also, clearly highlight the pivot in each partition b. Consider an unsorted array of integers of size n. Write a Java program to arrange the array...
please answer all parts and code thanks . - PART 1-Introduction to Sorting, 21 points Use this array of integer for the problems 1A, 1B, and 1c: 9 57 8324761 Each of these problems is worth 3 points A. Show the contents of the array each time a selection sort changes it while sorting the array into B. Show the contents of the array each time an insertion sort changes it while sorting C. Show the contents of the array...
Consider the following mergeSortHelper method, which is part of an algorithm to recursively sort an array of integers. /** Precondition: (arr.length == 0 or 0 <= from <= to <= arr.length) * arr.length == temp.length */ public static void mergeSortHelper(int[] arr, int from, int to, int[] temp) { if (from < to) { int middle = (from + to) / 2; mergeSortHelper(arr, from, middle, temp); mergeSortHelper(arr, middle + 1, to, temp); merge(arr, from, middle, to, temp); } } The merge method...