-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathUtils.cpp
More file actions
52 lines (41 loc) · 929 Bytes
/
Utils.cpp
File metadata and controls
52 lines (41 loc) · 929 Bytes
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
#include "Utils.h"
const std::string kNoSort = "<NO ALGORITHM>";
/**
* @brief Returns the name of the algorithms providing the number associated to it.
*
* @param sortType Number associated to the algorithm
* @return String of the algorithm name
*/
std::string Utils::getSortType(int sortType) {
switch (sortType)
{
case 0:
return "Bubble sort";
case 1:
return "Selection sort";
case 2:
return "Insertion sort";
case 3:
return "Quick sort";
case 4:
return "Cocktail sort";
case 5:
return "Bogo sort";
case 6:
return "Bitonic sort";
case 7:
return "Odd-Even sort";
default:
return kNoSort;
}
}
/**
* @brief Checks if the sort type exists
*
* @param sortType Number associated to the algorithm
* @return true The sort algorithm exists
* @return false The sort algoritm does not exist
*/
bool Utils::hasNextSortType(int sortType) {
return getSortType(sortType + 1) != kNoSort;
}