-
Notifications
You must be signed in to change notification settings - Fork 0
/
sorting.h
53 lines (40 loc) · 1.37 KB
/
sorting.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
48
49
50
51
52
53
#ifndef SORTING_H_INCLUDED
#define SORTING_H_INCLUDED
class Sorting {
private:
// Class object members + member variables
Allegro &allegro;
apvector <int> data;
apvector <int> originalData;
TRACKERS trackers;
public:
// Constructor
Sorting(Allegro &allegro);
void initializedRandomData();
// Destructor
~Sorting(){};
// Accessors
int getArrayLength() { return data.length(); }
apvector <int> getAllValues() { return data; }
TRACKERS getTrackers() { return trackers; }
// Modifiers
void setDataToOriginal() { data = originalData; }
void resetTrackers();
void setTimeDuration(double time) { trackers.timeDuration = time; }
void setSortedTracker(bool sorted) { trackers.sorted = sorted; }
// Basic Sorts
void bubbleSort();
void selectionSort();
// Merge Sort
void mergeMain();
void mergeData(int firstIndex, int midIndex, int lastIndex);
void mergeSort(int firstIndex, int lastIndex);
// Binary Search
void binarySearchMain();
void binarySearch(int leftIndex, int rightIndex, int target);
// Untilities
void resetDrawingIndex();
void drawFinishedSort();
void swapData(int &left, int &right);
};
#endif // SORTING_H_INCLUDED