需要按照homework sheet上的指&c

需要按照homework sheet上的指&c

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

View Full Document Right Arrow Icon
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++)
Image of page 1

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

View Full Document Right Arrow Icon
{ 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] << " "; }
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern