Task 2: Understand How Bottom-Up Merge Sort Works 22. Create a table showing how the merge operations modify the array in sequential order (include the table in your PDF answer as text): 25, 16, 21, 14, 26, 18, 23, 11, 20, 15, 22, 13, 17, 24, 12, 19 23. Pick a random array of 10 elements and create a merge table (include the table in your PDF answer as text) - do not pick a trivial array (e.g. 1, 2, 3... or 9, 8, 7, ...)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Task 2: Understand How Bottom-Up Merge Sort Works

  • 22. Create a table showing how the merge operations modify the array in sequential order (include the table in your PDF answer as text):
    • 25, 16, 21, 14, 26, 18, 23, 11, 20, 15, 22, 13, 17, 24, 12, 19
  • 23. Pick a random array of 10 elements and create a merge table (include the table in your PDF answer as text) - do not pick a trivial array (e.g. 1, 2, 3... or 9, 8, 7, ...)

Task 3: Bottom-Up Merge Sort Method

  • 31. In the sort.merge.bottomup package, create a public class named BottomUpMergeSort and a public class named BottomUpMergeSortTest
  • 32. In the class BottomUpMergeSort create a publlic static method sort that receives the array to be sorted. It creates the auxiliary array to be used for merging and for each length of a subarray starting from 1 to n and doubling the length each time, merge the adjacent subarrays 2 by 2:. 
    • Hint: See sort method in https://algs4.cs.princeton.edu/22mergesort/MergeBU.java.html
  • 34. In the class BottomUpMergeSortTest, create a static method named sortTest that will perform and print the result of a single test for the method sort from BottomUpMergeSort class. It receives the name of the test, the array to be merged and the expected result. It prints the received input, the result obtained by calling sort on the input and if the test was succesful (the result is identical with the expected result). Returns true if they are identical.
  • 35. In the class BottomUpMergeSortTest, create a static method named sortAllTests that will perform all the tests for sort method from class BottomUpMergeSort. It must call the previous method for sorting rrays each with the length of 0, 1, 2 (sorted), 2 (unsorted), 3 (sorted), 3 (decreasing), and 7. The values in the array must be random (do not use arrays like: 1, 2, 3, ... ). Do not use the same range for the arrays. The method must print at the end if all tests were successful or not. 
  • 36. In the class BottomUpMergeSortTest, create the main method and call the previous method. Check your resullts. 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Quicksort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education