摘要:
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
摘要:
二分查找方法二分查找经常用来在有序的数列查找某个特定的位置。因此,应用二分查找法,这个数列必须包含以下特征:存储在数组中有序排列二分查找方法不适用于链表,因为链表方法需要遍历,应用二分查找法意义不大。一般情况下,我们默认数组是单调递增数列,且无重复元素。(有重复元素的题应该如何解决)二分查找方法递归... 阅读全文