需要按照homework sheet上的指&c

需要按照homework sheet上的指&c

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 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++) { 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] << " "; } cout << "\n\n" ; vector <int> tem(nn.size()); merge(0, 19, nn, tem);...
View Full Document

Page1 / 7

需要按照homework sheet上的指&c

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online