-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.h
116 lines (104 loc) · 4.31 KB
/
stats.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/******************************************************************************
* Copyright (C) 2017 by Alex Fosdick - University of Colorado
*
* Redistribution, modification or use of this software in source or binary
* forms is permitted as long as the files maintain this copyright. Users are
* permitted to modify this and use it to learn about the field of embedded
* software. Alex Fosdick and the University of Colorado are not liable for any
* misuse of this material.
*
*****************************************************************************/
/**
* @file stats.h
* @brief Simple Program to print the statistics of the given data such as
- Maximum
- Minimum
- Mean
- Median
*
* <Add Extended Description Here>
*
* @author Hasan Güzelmansur
* @date 22/08/2021
*
*/
#ifndef __STATS_H__
#define __STATS_H__
/**************************************************************
* @brief Prints the array to the screen
* Takes an array and size as input.
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
*
*
* @return void
*
*************************************************************/
void print_array(unsigned char * temp, int size);
/**************************************************************
* @brief Prints maximum, minimum, median and Mean to the screen
* Takes an array, size, all the statistics as input.
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
* @param maximum An integer which has the maximum value of the array
* @param minimum An integer which has the minimum value of the array
* @param mean An integer which has the Mean value of the array
* @param median An integer which has the median value of the array
* @return void
*
*************************************************************/
void print_statistics(unsigned char * temp, int size, unsigned char maximum,
unsigned char minimum, unsigned char average, unsigned char median);
/**************************************************************
* @brief Calculates the maximum value of the array
Takes an array and the size as input
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
* @return An integer, maximum value of the array.
*
*************************************************************/
unsigned char find_maximum(unsigned char * temp, int size);
/**************************************************************
* @brief Calculates the minimum value of the array
Takes an array and the size as input
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
* @return An integer, minimum value of the array.
*
*************************************************************/
unsigned char find_minimum(unsigned char * temp, int size);
/**************************************************************
* @brief Calculates the mean of the array
Takes an array and the size as input
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
* @return an integer, mean of the array.
*
*************************************************************/
unsigned char find_mean(unsigned char * temp, int size);
/**************************************************************
* @brief Calculates the median of the array
Takes an array and the size as input
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
* @return an integer, median of the array.
*
*************************************************************/
unsigned char find_median(unsigned char * temp, int size);
/**************************************************************
* @brief Sorts the array, in non increasing values.
Takes an array and the size as input
*
* @param temp A unsigned char pointer to an n-element data array
* @param size An unsigned integer as the size of the array
* @return void
*
*************************************************************/
void sort_array(unsigned char * temp, int size);
#endif /* __STATS_H__ */