Binary Search
时间复杂度:
T(n) = T(n/2) + O(1) = O(logn)通过O(1)的时间,把规模为n的问题变为n/2
思考:通过O(n)的时间,把规模为n的问题变为n/2?
通用模板:
Last updated
Was this helpful?
时间复杂度:
T(n) = T(n/2) + O(1) = O(logn)通过O(1)的时间,把规模为n的问题变为n/2
思考:通过O(n)的时间,把规模为n的问题变为n/2?
通用模板:
Last updated
Was this helpful?