-
Notifications
You must be signed in to change notification settings - Fork 1
/
auxiliary.h
47 lines (37 loc) · 1.04 KB
/
auxiliary.h
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
#pragma once
//random number generator
void fillArr(vector<int>& arr, int range);
void fillArr(int arr[], int size, int range);
//print array
void prntArr(vector<int>& arr);
//output formatting. prints out title of respective case chosen.
void header(int inptCse);
//output formatting. prints range used.
void rangeFormat(int uC, int bestRange, int avgRange);
void rangeFormat(int uC, int bestRange, int avgRange) {
cout << "Range: ";
if (uC == 1) cout << bestRange;
else if (uC == 2)cout << avgRange;
else cout << INT_MAX / 1000;
cout << "\n";
}
void header(int inptCse) {
cout << "Batch\t";
if (inptCse == 1)cout << "Best-Case\n";
else if (inptCse == 2) cout << "Average-Case\n";
else if (inptCse == 3) cout << "Worst-Case\n";
}
void fillArr(vector<int>& arr, int range) {
for (int i = 0; i < arr.size(); i++) {
arr[i] = rand() % range;
}
}
void fillArr(int arr[], int size, int range) {
for (int i = 0; i < size; i++) {
arr[i] = rand() % range;
}
}
void prntArr(vector<int>& arr) {
for (auto a : arr) cout << a << " ";
cout << "\n";
}