running median of constant size array
问题 I am trying to find median of constant size array. But array is always uptading. I mean new numbers are replaced with old numbers. I call this process running median, or we can say on the fly median.. Here is my code and inside the code, when rand() function generates 78, the code cannot find the correct median. (Before 78; 41, 67, 34, 0, 69, 24 was generated) #include <iostream> #include <stdlib.h> #include <algorithm> #define MAX_SIZE 5 using namespace std; bool isOdd( int integer ) { if (