-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestdriver.cpp
More file actions
39 lines (24 loc) · 843 Bytes
/
Copy pathtestdriver.cpp
File metadata and controls
39 lines (24 loc) · 843 Bytes
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
#include <iostream>
#include <vector>
#include <stdlib.h>
#include "mergesortImproved.cpp"
using namespace std;
// array printing
void printArray(vector<int> &array) {
int size = array.size();
for (int i = 0; i < size; i++)
cout << "items" << "[" << i << "] = " << array[i] << endl;
}
int main() {
// array generation
vector<int> items;
int myints[] = { 5, 8, 9, 36, 2, 48, 6, 15, 55, 99, 67, 14, 78 };
items.assign(myints, myints + 13); // assigning from array.
cout << "initial:" << endl; // comment out when evaluating performance only
printArray(items); // comment out when evaluating performance only
// mergesort
mergesortImproved(items);
cout << "sorted:" << endl; // comment out when evaluating performance only
printArray(items); // comment out when evaluating performance only
return 0;
}