SyntaxFix
Write A Post
Hire A Developer
Questions
T(N) = T(N/2) + 1
T(N) = T(N/2) + 1 = (T(N/4) + 1)+ 1
...
T(N) = T(N/N) + (1 + 1 + 1 +... + 1) = 1 + logN (base 2 log) = 1 + logN
So the time complexity of binary search is O(logN)