1 votes 1 votes Algorithms algorithms time-complexity test-series + – Prince Sindhiya asked Oct 23, 2018 • retagged Jul 16, 2022 by Anjana5051 Prince Sindhiya 455 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply MiNiPanda commented Oct 23, 2018 reply Follow Share B)..? 0 votes 0 votes Magma commented Oct 23, 2018 reply Follow Share wrt to me also it should be B 0 votes 0 votes Prince Sindhiya commented Oct 23, 2018 reply Follow Share Yes bro it's b How to do? 0 votes 0 votes MiNiPanda commented Oct 23, 2018 reply Follow Share Take any value of x and see how many times fun1 is called. y doesn't matter here. If x=4 then fun1(4,y) --> fun1(3,4+y) -->fun1(2,3+y)--->fun1(1,2+y)--->fun1(0,1+y) 5 times. Similarly for any value of x fun1 will be called for x+1 times and in each call only constant work is done like comparison. So O(c*(x+1))=O(x) 0 votes 0 votes Magma commented Oct 23, 2018 reply Follow Share whatever the size of X you take the recursion stack size or depth of the recursion tree is also X try it ! 0 votes 0 votes Prince Sindhiya commented Oct 23, 2018 reply Follow Share Ok bhai thnxx :) 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes T(n)=T(n-1)+1 complexity will be 1+1+1+1.....n times =O(n) so B is the answer garimanand answered Oct 23, 2018 garimanand comment Share Follow See all 0 reply Please log in or register to add a comment.