摘要
对于一个具有单峰性的且数组内每个元素均不相同的一维数组A,查找其顶峰元素下标i,要求时间复杂度为O(log2n),问题形式化后经分析采用二分搜索方法,文中已给出算法伪代码,并从时间复杂度、空间复杂度等方面对算法进行了讨论。
For each element vary within a single peak and an array of one-dimensional array A,the subscript i find its peak elements,the re quired time complexity is O(log2n),after the formalization of the problem analysis using the binary search method has been given in the algorithm pseudo-code,and from time complexity,space complexity of the algorithm are discussed.
出处
《电脑知识与技术(过刊)》
2012年第5X期3359-3360,共2页
Computer Knowledge and Technology