-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstats.h
83 lines (67 loc) · 2.42 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
/******************************************************************************
* 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 function APIs for calculating maximum, minimum, mean, and median of the data set.
* Also reorder this data set from large to small.
*
* <Add Extended Description Here>
*
* @author Arbab Haider
* @date 02/04/2023
*
*/
#ifndef __STATS_H__
#define __STATS_H__
/**
* @brief A function that prints the statistics of an array including minimum, maximum,
* mean, and median.
* @param array given to the function and length
* @return None
*/
void print_statistics(unsigned char data[], int N);
/**
* @brief Given an array of data and a length, prints the array to the screen.
* @param array given to the function and length
* @return None
*/
void print_array(unsigned char data[], int N);
/**
* @brief Given an array of data and a length, returns the median value
* @param array given to the function and length
* @return middle element from the given array
*/
unsigned char find_median(unsigned char data[], int N);
/**
* @brief Given an array of data and a length, returns the mean
* @param array given to the function and length
* @return average of the given array
*/
unsigned char find_mean(unsigned char data[], int N);
/**
* @brief Given an array of data and a length, returns the maximum
* @param array given to the function and length
* @return largest element from the given array
*/
unsigned char find_maximum(unsigned char data[], int N);
/**
* @brief Given an array of data and a length, returns the minimum
* @param array given to the function and length
* @return smallest element from the given array
*/
unsigned char find_minimum(unsigned char data[], int N);
/**
* @brief Given an array of data and a length, sorts the array from largest to smallest.
* @param array given to the function and length
* @return array in reverse order
*/
void sort_array(unsigned char data[], int N);
#endif /* __STATS_H__ */