-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvizsorting.hpp
65 lines (62 loc) · 2.13 KB
/
vizsorting.hpp
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
#ifndef vizsorting_hpp
#define vizsorting_hpp
#include <iostream>
#include <thread>
#include <chrono>
#include <cmath>
#include <SFML/Graphics.hpp>
using namespace std;
class App {
private:
sf::RenderTexture* texture;
sf::RenderWindow* window;
int maxw;
int maxh;
int *a; //array to be sorted
int n; //number of items in array
int lcv; //left colored value
int rcv; //right colored value
int mcv; //middle colored value
int ssnum;
sf::Font font;
sf::Text text;
bool sorted; //state of values held in a
string currentAlgorithm; //for displaying algorithm being used
void exch(int a[], int l, int r);
//heapsorts
void downheap(int a[], int n, int k);
void upheap(int a[], int k);
void heapsort(int a[], int l, int r);
void floydheapsort(int a[], int l, int r);
//mergesorts
void mergesort(int a[], int n);
void mergesort(int a[], int aux[], int l, int r);
void bumsort(int a[], int n);
void tiledbumsort(int a[], int n);
void merge(int a[], int aux[], int l, int m, int r);
//quicksorts
void quicksort(int a[], int l, int r);
void quicksortR(int a[], int l, int r);
void introsort(int a[], int l, int r);
void introsortR(int a[], int l, int r, int d);
int findPivot(int a[], int l, int r);
int _medianOfMedians(int a[], int l, int r);
int partition(int a[], int l, int r);
//Other sorts
void shellsort(int a[], int l, int r);
void insertionsort(int a[], int l, int r);
void insertionsortNA(int a[], int n);
void selectionsort(int a[], int n);
void bubblesort(int a[], int n);
void exchangesort(int a[], int n);
void cocktail(int a[], int n);
void showHelp();
public:
App(int mw = 850, int mh = 500);
void start();
void handleEvent(sf::Event& event);
void sleep();
void render();
void renderSortArray();
};
#endif