which is faster execution: loops or recursion?
Answers were Sorted based on User's Feedback
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 |
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 |
what's the o/p int main(int n, char *argv[]) { char *s= *++argv; puts(s); exit(0); }
consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value
write a program to sum of its digit with using control structure or with out using loop. for ex: let the number is 25634 then answer will be=2+5+6+3+4=20
what is data structure?
Write a C program to get the desired output. 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 . . . 1 n..............n 1 Note: n is a positive integer entered by the user.
Write a program to compute the following 1!+2!+...n!
control 50 devices which has 2 states on and off.using bitwise operator.plz answer it its urgent
Is c pass by value or reference?
write a program which counts a product of array elements lower than 10.
Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58
how to make c program without a libary? e.g.#include<stdio.h> libary is not in c progaram.
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above