&eacute;œ€&egrave;&brvbar;&aelig;Œ‰&ccedil;…&sect;homework sheet&auml;&cedil;Š&ccedil;š„&aelig;Œ‡&c

# éœ€è¦æŒ‰ç…§homework sheetä¸Šçš„æŒ‡&c

This preview shows pages 1–3. Sign up to view the full content.

homework sheet ° ± c M ² s k K ² Goto Project/Properties ‚ ³ O M #include <iostream> #include <vector> #include <cstdlib> #include <time.h> using namespace std; //Quick Sort void quicksort(vector <int> &final, int left, int right);//vector void quicksort(int final[], int left, int right);//array //Merge Sort void merge(int low, int high, vector <int> &list, vector <int> &temp);//vector - recursive void mergesort(int low, int mid, int high, vector <int> &list, vector <int> &temp);//vector - mix void merge(int low, int high, int list[], int temp[]);//array - recursive void mergesort(int low, int mid, int high, int list[], int temp[]);//vector - mix int main() { //Quick Sort vector test vector <int> n; cout << "Quick Sort Vector test:" << endl; for(int i=0; i<20; i++) { n.push_back(rand()); cout << n[i] << " "; } cout << "\n\n" ; quicksort(n, 0, n.size() -1); for(int j=0; j<20; j++) { cout << n[j] << " "; } cout << "\n\n\n"; //Quick Sort array test int m[20]; cout << "Quick Sort Array test:" << endl; for(int i=0; i<20; i++) { m[i] = rand(); cout << m[i] << " "; } cout << "\n\n" ; quicksort(m, 0, 20-1); for(int j=0; j<20; j++)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
{ cout << m[j] << " "; } cout << "\n\n\n"; //Merge Sort vector test cout << "Merge Sort Vector test:" << endl; vector <int> nn; for(int i=0; i<20; i++) { nn.push_back(rand()); cout << nn[i] << " "; }
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern