第一篇:二分查找
摘要:看到排序数组或者部分排序数组,或者时间复杂度要求O(log n),应该第一时间想到二分查找。 在无重复的排序数组中找特定值的索引: func binarySearch(nums []int, target int) int { left := 0 right := len(nums) - 1 for
阅读全文
posted @ 2016-10-28 14:23
posted @ 2016-10-28 14:23
posted @ 2016-10-23 18:49
posted @ 2016-10-16 15:13