1int getMode(int *virus, int *frequency, int numVir)
2{
3 int count = 0,
4 index = 0,
5 mode = 0,
6 frLow = 0,
7 total = 0;
8
9 for (index = 0; index < numVir; index++)
10 {
11 count = 1;
12
13 while (*(virus + index) == *(virus + index + 1))
14 {
15 ++count;
16 ++index;
17 }
18
19 *(frequency + index) = count;
20
21 if (*(frequency + index) > frLow)
22 {
23 frLow = *(frequency + index);
24 total += *(frequency + index);
25 mode = *(virus + index);
26 }
27
28 else if (frLow == 1 || frLow == *(frequency + index))
29 {
30 return -1;
31 }
32 }
33
34 return mode;
35}