-
Notifications
You must be signed in to change notification settings - Fork 0
/
sorting.h
36 lines (26 loc) · 1.91 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
#include <vector>
#include "window.h"
/* Shuffle a vector to prepare for sorting */
void shuffle(std::vector<int>& nums);
/* BubbleSort Algorithm */
void bubbleSort(std::vector<int>& nums, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* SelectionSort Algorithm */
void selectionSort(std::vector<int>& nums, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* InsertionSort Algorithm */
void insertionSort(std::vector<int>& nums, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* Merge two subsequent parts of nums */
/* If return false, it means to stop the whole algorithm */
bool merge(std::vector<int>& nums, int start, int mid, int end, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* MergeSort Algorithm */
/* If return false, it means to stop the whole algorithm */
bool mergeSort(std::vector<int>& nums, int start, int end, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* Partition nums for QuickSort algorithm */
/* Return -1 if user pauses, otherwise return partition index */
int partition(std::vector<int>& nums, int start, int end, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* QuickSort Algorithm */
/* If return false, it means to stop the whole algorithm */
bool quickSort(std::vector<int>& nums, int start, int end, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* BogoSort Algorithm */
void bogoSort(std::vector<int>& nums, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);
/* SlowSort Algorithm */
bool slowSort(std::vector<int>& nums, int start, int end, sf::RenderWindow& window, Screen currentScreen, bool cursorOn, sf::Font& font, bool& paused);