Ready solutions
Either copy this code OR download from the link at the end of the file
SPECIFICATIONS FOR THIS PROJECT
You are required to choose two sorting algorithms from a specified list:
The first algorithm must be Bubble Sort, while the second algorithm can be either Merge
Sort or Heap Sort.
a) Write a C++ program where you implement the two sorting algorithms you have chosen -
ensure that they are part of the same program and can be called using methods, functions
and/or procedures.
b) Continue in this C++ program and generate random input arrays of different sizes,
specifically 100, 1000, and 5000 elements.
c) Utilize the implemented TWO sorting algorithms to sort these randomly generated arrays.
d) Generate a report to indicate:
- The input size (number of elements).
- The execution time for the two different sorting algorithms.
- The time complexity formulas for the two different sorting algorithms.
, Output:
Source Code:
//Your student number
//Your name
#include <iostream>
#include <vector>
#include <ctime>
#include <cstdlib>
#include <iomanip>
#include <cmath>
//#include "COS2611_As2_P1.h"
using namespace std;
//Function for the first sorting algorithm
// Bubble Sort implementation
void bubbleSort(vector<int>& arr) {
int n = arr.size();
// Traverse through all array elements