which is faster execution: loops or recursion?

Answers were Sorted based on User's Feedback

which is faster execution: loops or recursion?..

Answer / saran3589


Is This Answer Correct ?    16 Yes 2 No

which is faster execution: loops or recursion?..

Answer / nipa

loop is faster then recursion. because in recursion several
time function call itself, so it take time to pass control
to function and return value, but in loop control not pass
in other function it work in same function.here we consider
that function and loop contain same number of statement.

Is This Answer Correct ?    4 Yes 0 No

which is faster execution: loops or recursion?..

Answer / sight

It's not necessary that every time faster loops only because
it's depends upon the problem.....
On this we take decision that it's faster working with loop
or recursion....

Is This Answer Correct ?    6 Yes 4 No

Post New Answer

More C Interview Questions

Ca some one please help me with aC code to allow user enter numbers from 1 to 20 without repeating and prnt the sum of those numbers thnx

4 Answers  

main() { static char *s[]={"black","white","yellow","voilet"}; char **ptr[]={s+3,s+2,s+1,s}, ***p; p=ptr; **++p; printf("%s",*--*++p+3); }

0 Answers  

what are the facialities provided by you after the selection of the student.

0 Answers   TCS,

write a program to insert an element at the specified position in the given array in c language

5 Answers   IBM, Appin,

wat are the two methods for swapping two numbers without using temp variable??

2 Answers  

What is Bitwise Operator and how it works?

1 Answers  

write a c prog for removing duplicate character from an array and sorting remaining elements using a single array

1 Answers  

What is output of the following program ? main() { i = 1; printf("%d %d %d\n",i,i++,i++); }

9 Answers   Wipro, CTS,

yogesh patil in dell

3 Answers   DELL,

will u please send me the placement papers to my mail???????????????????

0 Answers  

what is difference between array of characters and string

18 Answers   Nest, Accenture,

#include<stdio.h> #include<conio.h> void main() {clrscr(); char another='y'; int num; for(;another=='y';) { printf("Enter a number"); scanf("%d",&num); printf("squre of %d is %d",num,num*num); printf("\nwant to enter another number y/n"); scanf("%c",&another); } getch(); } the above code runs only one time.on entering 'y' the screen disappeares.what can i do?

3 Answers