Implementation of the Running Median algorithm