click on the Link below to download the pdf version of LET US C by Yashwant Kanetkar
Thursday, April 4, 2013
Difference between Recursion and Iteration
RECURSION
|
ITERATIONS
|
Recursive
function – is a function that is partially defined by itself
|
Iterative
Instructions –are loop based repetitions of a process
|
Recursion
Uses selection structure
|
Iteration
uses repetition structure
|
Infinite
recursion occurs if the recursion step does not reduce the problem in a
manner that converges on some condition.(base case)
|
An
infinite loop occurs with iteration if the loop-condition test never becomes
false
|
Recursion
terminates when a base case is recognized
|
Iteration
terminates when the loop-condition fails
|
Recursion
is usually slower then iteration due to overhead of maintaining stack
|
Iteration
does not use stack so it's faster than recursion
|
Recursion
uses more memory than iteration
|
Iteration
consume less memory
|
Infinite recursion can
crash the system
|
infinite looping uses CPU
cycles
repeatedly
|
Recursion
makes code smaller
|
Iteration
makes code longer
|
Monday, April 1, 2013
S P A Question Bank
1. Explain function & its types.
2. Explain iterative instructions and its uses
3. Explain function & its advantages
4. Differentiate between if-else-if & switch-case
5. Expalin syntax of if else Ladder & list its drawback.
6. Explain & compare while & do while
7. Compare break & continue statement.
8. Write syntax for nested for loop with example.
9. Differentiate between iteration & recursion
10. Explain unconditional control instruction (goto, continue & break)
11. WAP to display.
A
B A
C B A
D C B A
12. 1
2 1
3 2 1
4 3 2 1
13. *
***
*****
14. WAP to find GCD of a number using function
15. WAP to check whether a no is prime.
16. WAP to find nth Fibonacci no.
17. WAP to find factorial of a no with function
18. WAP to find factorial of a no using recursion
19. Write a menu driven program to implement calculator
20 Find the value of x where x=1/2+2/3+3/4+4/5+---------+n/n+1
21. X= 12 + 22 + 32 ---------------n2
22. WAP to check whether no is Armstrong or not (eg input = 153).
Subscribe to:
Posts (Atom)
ECCF Question Describe the Block diagram of Operational Amplifier Draw the pin diagram of µA 741 op-amp Draw the schematic diagram o...
-
RECURSION ITERATIONS Recursive function – is a function that is partially defined by itself Iterative Instruct...
-
QUESTION BANK FOR I A E 2(APRIL 2015) SEM: II ...
-
video tutorials for file programming introduction to file programming https://www.youtube.com/watch?v=Vk8jndFozdQ modes of op...