0 votes 0 votes I think it should be O(L). Programming in C data-structures programming-in-c + – Xylene asked Aug 21, 2017 Xylene 979 views answer comment Share Follow See all 7 Comments See all 7 7 Comments reply Show 4 previous comments Shubhanshu commented Aug 21, 2017 reply Follow Share TC = O(min(len of L, len of P)) 0 votes 0 votes joshi_nitish commented Aug 21, 2017 reply Follow Share @Shubhanshu TC = O(min(len of L, len of P)), this is not correct, assume length of P = 1 and length of L = n, now P is only incremented when if condition is satisfied(it may be case that during entire program, P does not increment at all) but L will always increment at each iteration...so in worst case algorithm will run till O(L) 0 votes 0 votes Shubhanshu commented Aug 21, 2017 reply Follow Share Thanks, @joshi_nitish, I have interpreted the question in wrong way. and its TC = O(L). 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes O(L) is correct sandeepjkh answered Aug 25, 2017 sandeepjkh comment Share Follow See all 0 reply Please log in or register to add a comment.