/* CSC16/123/252 Assignment: Bubblesort This program compiles but crashes with a very bad memory error (rated R!) The bubblesort procedure can sort an array of numbers, but can it sort any type that defines the < operator? The `roster` type contains a pointer to a heap-allocated array, and < compares the sizes of these arrays. Can bubblesort sort an array of rosters? 1. (most important): Identify the cause of the error. I'm not asking you what the program "should" look like, but to understand exactly what caused the error! What kind of memory error (memory leak, dangling pointer, etc) is it, and which line(s) caused it. Be as specific as possible (don't just say it's using raw pointers). 2. Modify the roster struct as follows: a. change the line `string* students;` to unique_ptr students; b. change the line `students = new string[count];` to students = make_unique(count); c. remove the destructor 3. Did part 2 fix the problem? If not, EXPLAIN WHY. Then fix any new problems by modifying bubblesort. Bubblesort must be able to sort an array of rosters as well as any type that defines the < operator. ***** You may not modify main in any way ***** (except for temporary tracing couts) */ #include #include using namespace std; template // MY BUBBLESORT PROCEDURE CAN SORT ANYTHING! void bubblesort(T A[], int length) { for(int i=0;i R) { //constructor class_name = n; count = R.size(); students = new string[count]; // allocates array on heap int i =0; for(string n:R) students[i++] = n; } ~roster() { if (students) delete[] students; } // destructor // rosters are ordered by the count of the number of students bool operator <(roster& other) { return count < other.count; } // print roster friend ostream& operator <<(ostream& out, roster& r) { int i; out << "roster for " << r.class_name << ": "; for(i=0;i+1