forked from mihaicfx/utcn-fa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheap.h
86 lines (73 loc) · 2.63 KB
/
heap.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef __HEAP_H__
#define __HEAP_H__
#include "Profiler.h"
#include "commandline.h"
namespace lab02
{
/**
* @brief iterative implementation of a sorting algorithm from Laboratory 1
*
* @param values array of input values to be sorted
* @param n number of values in the input array
* @param opAsg optional counter for assignment operations
* @param opCmp optional counter for comparison operations
*/
void iterativeSort(int* values, int n, Operation* opAsg = nullptr, Operation* opCmp = nullptr);
/**
* @brief recursive implementation of the same sorting algorithm from Laboratory 1
*
* @param values array of input values to be sorted
* @param n number of values in the input array
* @param opAsg optional counter for assignment operations
* @param opCmp optional counter for comparison operations
*/
void recursiveSort(int* values, int n, Operation* opAsg = nullptr, Operation* opCmp = nullptr);
/**
* @brief bottomup build heap procedure
*
* @param values array of input values to be sorted
* @param n number of values in the input array
* @param opAsg optional counter for assignment operations
* @param opCmp optional counter for comparison operations
*/
void buildHeap_BottomUp(int* values, int n, Operation* opAsg = nullptr, Operation* opCmp = nullptr);
/**
* @brief topdown build heap procedure
*
* @param values array of input values to be sorted
* @param n number of values in the input array
* @param opAsg optional counter for assignment operations
* @param opCmp optional counter for comparison operations
*/
void buildHeap_TopDown(int* values, int n, Operation* opAsg = nullptr, Operation* opCmp = nullptr);
/**
* @brief Heap sort algorithm
*
* @param values array of input values to be sorted
* @param n number of values in the input array
* @param opAsg optional counter for assignment operations
* @param opCmp optional counter for comparison operations
*/
void heapSort(int* values, int n, Operation* opAsg = nullptr, Operation* opCmp = nullptr);
/**
* @brief Demo code for the sorting algorithms
*
* @param size number of elements to demonstrate on
*/
void demonstrate(int size);
/**
* @brief Performance analysis for the sorting algorithms
*
* @param profiler profiler to use
* @param whichCase one of AVERAGE, BEST or WORST cases
*/
void performance(Profiler& profiler, AnalysisCase whichCase);
/**
* @brief Benchmarking for the sorting algorithms
*
* @param profiler profiler to use
* @param whichCase one of AVERAGE, BEST or WORST cases
*/
void benchmark(Profiler& profiler, AnalysisCase whichCase);
} // namespace lab02
#endif // __HEAP_H__