Question
For doing this assignment, a non-threaded program (assignment2_bubblesort.cpp) is provided. It performs bubble sort for n-numbers of randomly generated numbers. When running the program, you
For doing this assignment, a non-threaded program (assignment2_bubblesort.cpp) is provided. It performs bubble sort for n-numbers of randomly generated numbers. When running the program, you must place the header file ("hpc_helpers.hpp") in the same directory where your source code is located. Otherwise, it will cause a compilation error. Task 1. Create a bubble sort function using r-value referencing when swapping values. Task 2. Create a multi-threaded program to run the r-value referencing bubble sort. Task 3. Run the three bubble sort with different input numbers - 10, 100, 500, 1000, 3000, 5000, 8000, 10000, 50000, and 100000 in three scenarios to measure execution times; Scenario 1. Running the original bubble sort Scenario 2. Running the r-value referencing bubble sort Scenario 3. Running the r-value referencing bubble sort with a threaded program (running the bubble sort in a child thread) After measuring the execution times, you need to create a line graph showing how the bubble sort with three scenarios work differently. In the line graph, you must set the x-axis with the input number of elements and y-axis with execution time (seconds). Please note that you must run each scenario five times.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started