-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBubbleSort.h
38 lines (33 loc) · 845 Bytes
/
BubbleSort.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
//
// Created by daily on 03-01-24.
//
#ifndef ALGOVISUALIZER_BUBBLESORT_H
#define ALGOVISUALIZER_BUBBLESORT_H
#include "IRenderable.hpp"
#include <vector>
class BubbleSort : public IRenderable{
public:
BubbleSort(int dataSize);
void update() override;
void render(SDL_Renderer* renderer) override;
void startSort();
void setScreenDimensions(int width, int height);
private:
std::vector<int> data;
int currentIdx;
bool sorting;
int dataSize_;
int screenWidth;
int screenHeight;
int comparisonIdx;
bool swappedInLastPass;
int sortedCount;
int lastSwapIndex;
unsigned long long swapCount;
unsigned long long comparisonCount;
bool greenIterationStarted;
bool whiteIterationStarted;
int iterationCount;
bool isComplete;
};
#endif //ALGOVISUALIZER_BUBBLESORT_H