Question: I have my coding for my final assignment almost complete. I ' m running into 4 errors that I cannot wrap my head around. Sorting

I have my coding for my final assignment almost complete. I'm running into 4 errors that I cannot wrap my head around. Sorting has been a nightmare for me. Could you take a look at my header coding and implementation coding below, as well as my driver file SS? I would love to figure out how to fix these errors and run this code. #ifndef SORTING_ALGORITHM_H
#define SORTING_ALGORITHM_H
#include
#include
class Sort {
public:
void bubbleSort(std::vector& arr);
void quickSort(std::vector& arr, int low, int high);
int partition(std::vector& arr, int low, int high);
void printArray(const std::vector& arr);
};
#endif #include "sorting_algorithm.h"
void Sort::bubbleSort(std::vector& arr){
int n = arr.size();
for (int i =0; i n -1; i++){
for (int j =0; j n - i -1; j++){
if (arr[j]> arr[j +1]){
std::swap(arr[j], arr[j +1]);
}
}
}
}
int Sort::partition(std::vector& arr, int low, int high){
int pivot = arr[high];
int i = low -1;
for (int j = low; j high; j++){
if (arr[j]= pivot){
i++;
std::swap(arr[i], arr[j]);
}
}
std::swap(arr[i +1], arr[high]);
return i +1;
}
void Sort::quickSort(std::vector& arr, int low, int high){
if (low high){
int pi = partition(arr, low, high);
quickSort(arr, low, pi -1);
quickSort(arr, pi +1, high);
}
}
void Sort::printArray(const std::vector& arr){
for (int num : arr){
std::cout num "";
}
std::cout std::endl;
}
I have my coding for my final assignment almost

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!