Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
0 votes
Which rule of recursion is violated in the following code

int rec(int n)


if(n == 0)

return 0;


return (n + rec(n/2) +rec(n/2+ 1);


A) No base case

 B ) Fails to make progress

 C) It performs redundant work

 D) No violation
in Programming 15 points 13 views
I could not find any redundant work from recursion tree .  no violation is ans ?
$$rec(1) = 1 + rec(\frac{1}{2}) + rec(\frac{1}{2} + 1) = 1 + rec(0) + rec(1)$$

Option b, fails to make progress
@shubhajit panday

Ans - b,c

Please log in or register to answer this question.