Tasks This assignment has three parts: Create two identical integer arrays with 10,000 elements. Bubble sort an
Question:
Tasks
This assignment has three parts:
- Create two identical integer arrays with 10,000 elements.
- Bubble sort an array of 10,000 elements linearly.
- Bubble sort an array of 10,000 elements in parallel.
Task 1 – Create the Arrays
The first step is to create two completely identical arrays with 10,000 integers in each of them. Create one array using random values. Any values from the smallest integer possible to the largest is fine. Then create another array by performing a deep copy. They must be two distinct objects, DO NOT perform a shallow copy.
Task 2 – Linear Bubble Sort
Using one of the arrays previously created, use the bubble sort algorithm to sort it. Do so in a linear fashion. This can be done simply by using a few loops, as it was introduced in 1321L. Make sure to time the program as it performs the bubble sort.
Task 3 – Parallel Bubble Sort
Use the other array and perform a bubble sort on it, but this time in parallel. This can be done in many ways, but all make use of some parallel code implemented in the standard library. You may use any method of parallelism. Make sure to time the program as it performs the bubble sort.
Print out the time it takes to perform both methods of sorting. Make sure that enough decimal places are included to show a difference in performance between the two.
Financial Reporting and Analysis
ISBN: 978-0078025679
6th edition
Authors: Flawrence Revsine, Daniel Collins, Bruce, Mittelstaedt, Leon