1) Code and analyse the function findMaximums(). 2) Use a sorted data structure (a binary tree). 3) std::vector<int> findMaximums(int* Data, int N, int K) where 4) Data is an array of int's. 5) N is the size of the array Data. 6) K is the number of element from Data you want to compare and maximize. 7) The vector you return is the list of these "local maximums".
Sigiloso
std::vector findMaximums(int* Data, int N, int K) { std::vector list; qsort(Data, n, sizeof(int), compare); for (int i = N ; i--; i>0) { if (Data[i]>K) list.push_back(Data[i]); else break; } return list; }