哪里是在实践中使用二进制搜索? [英] Where is binary search used in practice?

查看:153
本文介绍了哪里是在实践中使用二进制搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个程序员教导了二分搜索是搜索数据的顺序列表的好,快速的方法。有使用二进制搜索很多玩具课本上的例子,但如何在真正的编程:哪里是在现实生活中的方案实际使用二进制搜索

解决方案

二分查找时的到处

的。任取有序集合任何语言库(Java,.NET,C ++ STL等),他们都将使用(或必须使用该选项)二进制搜索找到的值。虽然如此,你必须很少实现它,你还是要理解背后的原理是利用它的优势。

Every programmer is taught that binary search is a good, fast way to search an ordered list of data. There are many toy textbook examples of using binary search, but what about in real programming: where is binary search actually used in real-life programs?

解决方案

Binary search is used everywhere. Take any sorted collection from any language library (Java, .NET, C++ STL and so on) and they all will use (or have the option to use) binary search to find values. While true that you have to implement it rarely, you still have to understand the principles behind it to take advantage of it.

这篇关于哪里是在实践中使用二进制搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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