Page 50 - DCAP201_FUNDAMENTALS_OF_DATA_STRUCTURES
P. 50
Unit 3: Recursion
Iteration: Iteration is a problem-solving or computational method in which a succession of Notes
approximations used to achieve a desired degree of accuracy.
Recursion: Recursion is a computer programming technique involving the use of a procedure,
subroutine, function, or algorithm that calls itself in a step having a termination condition.
Recursive Expression: A recursive expression is a function, algorithm, or sequence of instructions
that loops back to the beginning of itself until it detects that some condition has been satisfied.
Recursive Function: A recursive function is a function that calls itself during its execution.
Recursive Procedure: A recursive procedure or routine is one that has the ability to call itself.
3.5 Review Questions
1. Explain the concept of recursion with example.
2. Discuss the advantages and disadvantages of recursion.
3. Discuss the situation where recursion provides the best solution.
4. What is a recursive function? Discuss with example.
5. If proper cases are not included in the function to stop the execution, the recursion will
repeat forever. Comment.
6. Write a C program to calculate the power of a number using recursion.
7. Write a C program to find size of int, float, double and char of your system.
8. Write a C program to check whether a number is positive or negative or zero.
9. Write a C program to Count Number of Digits of an Integer.
10. Write a recursive C program to find the maximum value in an array.
Answers: Self Assessment
1. True 2. True
3. False 4. True
5. False 6. True
7. recursive function 8. Definite
9. Count() 10. Infinite
11. execution 12. stack overheads
13. end 14. natural numbers
15. Reverse
3.6 Further Readings
Books Davidson, 2004, Data Structures (Principles and Fundamentals), Dreamtech Press
Karthikeyan, Fundamentals, Data Structures and Problem Solving, PHI Learning
Pvt. Ltd.
LOVELY PROFESSIONAL UNIVERSITY 43