0% found this document useful (0 votes)
71 views1 page

Lab12 PDF

This document provides instructions for writing 6 recursive functions for a data structures and algorithms lab assignment: 1) a function to calculate the nth Fibonacci number, 2) a factorial function, 3) a function to sum the digits of an integer, 4) a function to find the minimum element in an array, 5) a function to convert a decimal number to binary, and 6) a function to calculate the sum of a fractional series.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views1 page

Lab12 PDF

This document provides instructions for writing 6 recursive functions for a data structures and algorithms lab assignment: 1) a function to calculate the nth Fibonacci number, 2) a factorial function, 3) a function to sum the digits of an integer, 4) a function to find the minimum element in an array, 5) a function to convert a decimal number to binary, and 6) a function to calculate the sum of a fractional series.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

CSE225L – Data Structures and Algorithms Lab

Lab 12
Recursion

1. Write a recursive function that returns the nth Fibonacci number from the Fibonacci
series.
int fib(int n);

2. Write a recursive function to find the factorial of a number.


int factorial(int n);

3. Write a recursive function that returns the sum of the digits of an integer.

int sumOfDigits(int x);

4. Write a recursive function that find the minimum element in an array of integers.
int findMin(int a[], int size);

5. Write a recursive function that converts a decimal number to binary number.


int DecToBin(int dec);

6. Write a recursive function that find the sum of the following series.
1 + 1/2 + 1/4 + 1/8 + ... + 1/2n

You might also like