在解决几何问题,我读到一篇名为方式滑动窗口算法。
While solving a geometry problem, I came across an approach called Sliding Window Algorithm.
难道真的找不到它的任何学习材料/细节。
Couldn't really find any study material/details on it.
什么是对的算法?
一般来说滑动窗口是一个子列表运行在底层集。即,如果你有一个像数组
Generally speaking a sliding window is a sub-list that runs over an underlying collection. I.e., if you have an array like
[a b c d e f g h]
3大小的滑动窗口将运行在它就像
a sliding window of size 3 would run over it like
[a b c]
[b c d]
[c d e]
[d e f]
[e f g]
[f g h]
如果你比如说要计算一个平均运行这是有用的,如果你想创建一个集中的所有相邻对等。
This is useful if you for instance want to compute a running average, or if you want to create a set of all adjacent pairs etc.