We present a linear-time algorithm for computing sliding window maximum and minimum filters over one-dimensional signals. The algorithm is based on a single forward pass using a double-ended queue (deque) and requires only a small amount of memory. It supports in-place and streaming implementations. We provide a self-contained description of the algorithm, including illustrative examples, pseudocode, a practical implementation in C, and an analysis of its runtime behavior. We compare the performance of the algorithm against the well-known Van Herk–Gil–Werman (HGW) algorithm, which performs three scans over the data and offers data-independent performance.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

A Linear Time Algorithm for Local Minimum and Maximum Filters

  • Arnold Meijster,
  • Mattia Marziali

摘要

We present a linear-time algorithm for computing sliding window maximum and minimum filters over one-dimensional signals. The algorithm is based on a single forward pass using a double-ended queue (deque) and requires only a small amount of memory. It supports in-place and streaming implementations. We provide a self-contained description of the algorithm, including illustrative examples, pseudocode, a practical implementation in C, and an analysis of its runtime behavior. We compare the performance of the algorithm against the well-known Van Herk–Gil–Werman (HGW) algorithm, which performs three scans over the data and offers data-independent performance.