-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuicksort_main.cpp
52 lines (41 loc) · 1.17 KB
/
Quicksort_main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <iostream>
#include <fstream>
#include "quicksort.h"
using std::cout;
using std::uint64_t;
using std::ofstream;
uint64_t rdtsc(){
unsigned int lo,hi;
__asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
return ((uint64_t)hi << 32) | lo;
}
const int TEST_RANGE_START = 0;
const int TEST_RANGE_END = 10000;
int main()
{
/*
ofstream outputfile;
outputfile.open("data.csv");
for(int i = TEST_RANGE_START; i < TEST_RANGE_END; ++i) {
// 4 * 1-100
int myarr[i];
for (int j = 0; j < i; ++j)
myarr[j] = (rand() % 100); // 0-90000
uint64_t start = rdtsc();
quicksort<int>().sort(myarr, i);
uint64_t delta = rdtsc() - start;
outputfile << i << "," << delta << "\n";
}
outputfile.close();
*/
std::string startString = "google";
int strlength = startString.length();
char myarray[strlength];
startString.copy(myarray,strlength);
myarray[strlength] = '\0';
int arrlength = sizeof(myarray)/sizeof(myarray[0]);
quicksort<char>().sort(myarray, arrlength);
std::string mystring(myarray);
std::cout << startString << "\n" << mystring;
return 0;
}