The proposed design is a circuit that determines the order statistics of an arbitrary length, N, string of numbers as the string is acquired. The computational time complexity for the design is optimally O(N). This is a valuable filtering method, e.g., the median filter, for suppressing and quite often eliminating impulse noise while preserving the edges of objects in an image. Two other closely related methods of order statistic filtering, stack filters, and morphological algebra, are determined to be very limited with regard to the number of template or window elements that can be used in the filtering process and not practical for two-dimensional imagery. The comparator stack circuit does not have this restriction. Also, the comparator stack method operates at or near the same cost function as a single convolution operation with the same template configuration, thus O(N).