} // quicksort
#include #include #include // main functionvoid main () {clock_t start, end; float elapsed1; // time of quicksort float elapsed2; // time of infinsertionsort const Int n = 30001; const Int m = 30000; int 1 INT W;
Cout << "| ------ Rapid Sort and Insert Sort Algorithm ----- | << Endl; Cout <<" | --------- Data Size: 30000- ---------- | << Endl; cout << "| --- Power by zhanjianTao (028054115) --- |" << endl; cout << "------- -------------------------------- "<< endl; cout <<" running ... "<< endl;
While (w) {// INSERTIONSORT START = Clock (); // Start TimeInt a [M]; for (i = 0; i
INSERTIONSORT (A, M);
End = clock (); // finish time
ELAPSED2 = ((float) end-start) / clocks_per_sec;
// Insertionsort
// QuickSort start = clock (); // start time int R [n]; for (i = 1; i <= n; i ) R [i] = rand ();
Quicksort (R, 1, N);
End = clock (); // Time Finish
ELAPSED1 = (FLOAT) End-start / clocks_per_sec; // QuickSort Cout << "Select <3> Verify INSERTIONSORT's correctness" << Endl; cout << "Select <2> Verify QUICKSORT correctness" << Endl; cout << "Select <1> Compare Algorithm Operation Time" << Endl; Cout << "Select <0> Exit" << Endl; CIN >> W; Switch (w) {
Case 3: for (i = 0; i