什么是滑窗算法?例子? [英] What is Sliding Window Algorithm? Examples?

查看:1423
本文介绍了什么是滑窗算法?例子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在解决几何问题,我读到一篇名为方式滑动窗口算法。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆