什么是滑动窗口算法?例子? [英] What is Sliding Window Algorithm? Examples?
本文介绍了什么是滑动窗口算法?例子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在解决几何问题时,我遇到了一种称为滑动窗口算法的方法.
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.
这篇关于什么是滑动窗口算法?例子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文