6 votes 6 votes How to get space complexity of binary search .. I am getting confusion in Space complexity = ip + extra (stack) And ip = nB ( why it is nB) ????? And extra = logn B So nB+ log n B = O(n) ... Algorithms algorithms binary-search + – air1ankit asked Aug 9, 2017 air1ankit 1.9k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes Space complexity is the sum of stack space and size of input ... as you have n elements and assuming it is of 1 byte all n are of n B and log n is the stack space so n+ log n which will give order of n Sachdev aprajita answered May 22, 2019 Sachdev aprajita comment Share Follow See all 0 reply Please log in or register to add a comment.