二进制搜索算法_使用安全摄像机镜头解释二进制搜索算法

二进制搜索算法

by Julia Geist

Julia·盖斯特(Julia Geist)

使用安全摄像机镜头解释二进制搜索算法 (Binary Search Algorithms explained using security camera footage)

Binary search, also known as half-interval search or logarithmic search, is a search algorithm that finds the position of a target value within a sorted array.
二进制搜索(也称为半间隔搜索或对数搜索)是一种搜索算法,用于查找排序数组中目标值的位置。

语境 (Context)

I used to live in a building that had a communal kitchen for over 100 students. As you might imagine, there were almost always dishes that weren’t washed in the sink. A group at my school pitched the idea to put up a Nest Cam to catch culprits and call them out on it using the Nest Cam feed.

我曾经住在一栋有公用厨房的大楼里,可容纳100多名学生。 就像您想象的那样,几乎总是有没有在水槽中洗过的盘子。 我学校的一个小组提出了创建一个Nest Cam来捕捉罪犯的想法,并使用Nest Cam feed将其召唤出来。

To illustrate my point, let’s say you found dirty dishes at 12 pm, and you hadn’t been in the kitchen for a day.

为了说明我的观点,假设您在中午12点发现了脏盘子,而您一天都没有在厨房里。

Think about the way that you would search for the person who left the dishes. Would you watch all 24 hours of footage, from the beginning, until you found the culprit?

考虑一下您寻找离开盘子的人的方式。 从头开始,直到发现罪魁祸首,您是否会观看所有24小时的录像?

Probably not. Most likely you’d be hopping around the footage, checking to see if the dishes were in the sink, say, 12 hours ago — at 12 am. If they were, then you’d know that it happened before 12 am. You might flip back to 10 pm after that. If the dishes aren’t there, you’ve now narrowed down the time frame from 10 pm to 12 am — in other words, you’ve ruled out any time before 10 pm. You’d continue this process until you found the culprit.

可能不是。 例如,您很可能会在画面上跳来跳去,例如12个小时前的凌晨12点,检查盘子是否在水池中。 如果是这样,那么您会知道它发生在上午12点之前。 之后,您可能会回到晚上10点。 如果菜都没有 ,你现在已经缩小的时限从10点至12点-换句话说,你已经晚上10点之前排除了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值