DATA STRUCTURES AND ALGORITHMS
Practical 2: Recursion Implementation and Its Application in
Problem Solving
Prepared for Academic Submission
Practical 2.1: GCD of Two Numbers Using Recursion
Project Folder Structure:
• YOURNAME/DSA/RECURSION/[Link]
Questions:
Q1. State the objective of finding GCD using recursion.
Q2. Explain the theory of recursion and its advantages in problem solving.
Q3. Write the C++ algorithm for calculating GCD of two numbers recursively.
Q4. Solve manually the GCD of two numbers, e.g., 36 and 60, using recursion trace.
Q5. Implement the recursive GCD program in C++ and attach a neat output screenshot.
Practical 2.2: Factorial of a Number Using Recursion
Project Folder Structure:
• YOURNAME/DSA/RECURSION/[Link]
Questions:
Q1. State the objective of finding factorial using recursion.
Q2. Explain the recursive approach for factorial calculation.
Q3. Write the C++ algorithm for computing factorial recursively.
Q4. Solve manually factorial of 5 using recursion trace.
Q5. Implement the recursive factorial program in C++ and attach a neat output screen-
shot.
1
Practical 2.3: Fibonacci Series up to Nth Term Using Recursion
Project Folder Structure:
• YOURNAME/DSA/RECURSION/[Link]
Questions:
Q1. State the objective of generating Fibonacci series using recursion.
Q2. Explain the recursive approach to generate Fibonacci numbers.
Q3. Write the C++ algorithm for printing Fibonacci series up to nth term recursively.
Q4. Manually generate Fibonacci series up to 7 terms using recursion trace.
Q5. Implement the recursive Fibonacci program in C++ and attach a neat output screen-
shot.
Practical 2.4: Tower of Hanoi Using Recursion
Project Folder Structure:
• YOURNAME/DSA/RECURSION/[Link]
Questions:
Q1. State the objective of solving Tower of Hanoi using recursion.
Q2. Explain the recursive algorithm for Tower of Hanoi.
Q3. Write the C++ algorithm to move disks from source to destination recursively.
Q4. Solve manually Tower of Hanoi for 3, 4, and 5 disks and write the minimum number
of steps required.
Q5. Implement the Tower of Hanoi program in C++ and attach a neat output screenshot.
Note: Please use the best copy and clear handwriting.
Questions should be written in red pen. Answers should be written in blue or black pen.
Prepared courteously by AI Engineer Thomas Basyal ([Link]@[Link])