阅读背景:

对未排序数组的二进制搜索的时间复杂度。

来源:互联网 

I am stuck up with two time complexities. To do a binary search with sorted array is O(logN). So to search an unsorted array we have to sort it first so that becomes O(NlogN). So then we can perform binary search which gives the complexity as O(N) but I have read that it could be O(NlogN). Which is correct?I am stuck up with two time complexities. To do




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: