-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInitialize.cpp
More file actions
82 lines (72 loc) · 1.51 KB
/
Initialize.cpp
File metadata and controls
82 lines (72 loc) · 1.51 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "Header.h"
void Sorting::DoSort(int * arr, int n)
{
for (int i = 0; i < n; i++)
arr[i] = i;
}
void Sorting::InitSorted()
{
DoSort(_a100, 100);
DoSort(_a200, 200);
DoSort(_a300, 300);
DoSort(_a400, 400);
DoSort(_a500, 500);
DoSort(_a1000, 1000);
DoSort(_a2000, 2000);
DoSort(_a4000, 4000);
DoSort(_a10000, 10000);
}
void Sorting::DoReverseSort(int * arr, int n)
{
for (int i = 0; i <n; i++)
arr[i] = n - i;
}
void Sorting::InitReverseSorted()
{
DoReverseSort(_a100, 100);
DoReverseSort(_a200, 200);
DoReverseSort(_a300, 300);
DoReverseSort(_a400, 400);
DoReverseSort(_a500, 500);
DoReverseSort(_a1000, 1000);
DoReverseSort(_a2000, 2000);
DoReverseSort(_a4000, 4000);
DoReverseSort(_a10000, 10000);
}
void Sorting::DoPermutation(int * arr, int n)
{
for (int i = 0; i < n; i++)
{
arr[i] = i;
}
randomize(arr, n);
}
void Sorting::InitPermutation()
{
DoPermutation(_a100, 100);
DoPermutation(_a200, 200);
DoPermutation(_a300, 300);
DoPermutation(_a400, 400);
DoPermutation(_a500, 500);
DoPermutation(_a1000, 1000);
DoPermutation(_a2000, 2000);
DoPermutation(_a4000, 4000);
DoPermutation(_a10000, 10000);
}
void Sorting::DoRandom(int *arr, int n)
{
for (int i = 0; i < n; i++)
arr[i] = random(n);
}
void Sorting::InitRandom()//generates random arrays for each array
{
DoRandom(_a100, 100);
DoRandom(_a200, 200);
DoRandom(_a300, 300);
DoRandom(_a400, 400);
DoRandom(_a500, 500);
DoRandom(_a1000, 1000);
DoRandom(_a2000, 2000);
DoRandom(_a4000, 4000);
DoRandom(_a10000, 10000);
}