Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试图用谷歌搜索这个主题,但找不到任何令人满意的东西。问题是:我们能否将未排序数组的二分搜索应用到可以在 O(logN) 左右完成的搜索。
请有人为我指出这个问题的正确解决方案。PS:我有 80% 的把握这篇文章可能是重复的
您不能对未排序的数组进行二进制搜索。就那么简单。单调递增或递减函数对于二分查找至关重要,因此您可以决定在哪一半继续查找。