62 votes 62 votes Consider the following C function. int fun(int n) { int x=1, k; if (n==1) return x; for (k=1; k<n; ++k) x = x + fun(k) * fun (n-k); return x; } The return value of $fun(5)$ is ______. Algorithms gatecse-2015-set2 algorithms identify-function recurrence-relation normal numerical-answers + – go_editor asked Feb 12, 2015 • edited Nov 2, 2017 by kenzou go_editor 21.2k views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments Jay Thesia commented Oct 16, 2020 reply Follow Share Here if we use k++ instead of ++k what was the ans ? 0 votes 0 votes Kiyoshi commented Jun 7, 2021 reply Follow Share Can anyone help me what is the time complexity of this function?? is it O(2^n). 0 votes 0 votes RamaSivaSubrahmanyam commented Aug 29, 2022 reply Follow Share recursive Equation is f(n)=n+2*[f(n-1)+f(n-2)+...f(1)] If you solve this Complexity will be O(3^n) 0 votes 0 votes Please log in or register to add a comment.
5 votes 5 votes Answer: 51. Find the running code here: http://ideone.com/wrLiLm Rajarshi Sarkar answered Feb 12, 2015 • edited Feb 12, 2015 by Rajarshi Sarkar Rajarshi Sarkar comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes Ans 51 Vikrant Singh answered Feb 7, 2015 Vikrant Singh comment Share Follow See 1 comment See all 1 1 comment reply shilajit commented Jul 10, 2015 reply Follow Share How? please explain... 0 votes 0 votes Please log in or register to add a comment.
2 votes 2 votes Ans C)51 F(1)=1 F(2)=2 F(3)=6 F(4)=12 F(5)=51 Rahul Jain25 answered Jan 18, 2017 Rahul Jain25 comment Share Follow See all 0 reply Please log in or register to add a comment.
1 votes 1 votes F(1) = 1 F(2) = 2 F(3) = 5 F(4) =15 F(5) = 51. selvaprakash211 answered Sep 28, 2015 selvaprakash211 comment Share Follow See 1 comment See all 1 1 comment reply papesh commented Aug 21, 2016 reply Follow Share Right 0 votes 0 votes Please log in or register to add a comment.