![theyfallfora](/avatars/39226.jpg)
theyfallfora
24.04.2020 •
Computers and Technology
Tasks
//Written in Java
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.
∃ Some Sample Output:
Finished creating identical arrays.
Starting linear bubble sort, please wait...
Finished linear bubble sort.
Starting parallel bubble sort, please wait...
Finished parallel bubble sort.
Time for linear bubble sort: 0.0001274 seconds
Time for parallel bubble sort: 0.0000512 seconds
Solved
Show answers
More tips
- L Leisure and Entertainment Carving: History and Techniques for Creating Vegetable and Fruit Decorations...
- P Photography and Videography How to Choose the Perfect Photo Paper for Your Images?...
- H Health and Medicine What vaccines do children need?...
- H Health and Medicine Reasons for the Appearance of Warts: Everything You Need to Know...
- A Art and Culture How to Learn Screaming: Step-by-Step Guide for Beginners...
- H Health and Medicine Contraceptive Pills After 35: The Importance Of Choosing The Right Medication...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
- S Style and Beauty How to Make Your Lips Fuller? Ideas and Tips for Beautiful Lips...
Answers on questions: Computers and Technology
- M Mathematics Y=|2x-3|+1does this represent a function and why...
- S Social Studies Will mark ! insect fossils are not very common because: their bodies are easily destroyed there were not many insects in the past insects had hard shells for protection...
- M Mathematics For the following right triangle, find the side length X. Round your answer to the nearest hundredtr...
- M Mathematics PLZ ANSWER having a hard time with this one...
Ответ: