Showing posts with the label Recursion

Write a recursive Python function that has a parameter representing a list of integers and returns the maximum stored in the list.

Q. Write a recursive Python function that has a parameter representing a list o…

We can determine how many digits a positive integer has by repeatedly dividing by 10.

Q. We can determine how many digits a positive integer has by repeatedly dividi…

A Geometric Progression (GP) is a progression where the each term is a multiple of the previous one.

Q. Designing recursive code. A Geometric Progression (GP) is a progression whe…

Compare and contrast the use of iteration and recursion in terms of memory space and speed.

Q. Compare and contrast the use of iteration and recursion in terms of memory s…

If any recursive function can be easily written using iterative code, then what is the need for recursion?

Q. If any recursive function can be easily written using iterative code, then w…

Why are recursive functions considered slower than their iterative counterparts?

Q. Why are recursive functions considered slower than their iterative counterpa…

Identify the base case(s) in the following recursive function:

Q. Identify the base case(s) in the following recursive function:   def fun…

Can each recursive function be represented through iteration? Give examples.

Q. Can each recursive function be represented through iteration? Give examples.…

Which of the function given in previous question will result into infinite recursion?

Q. Which of the function given in previous question will result into infinite r…

Give some examples that can be represented recursively.

Q. Give some examples that can be represented recursively.   Answer = • S…

How can you stop/resolve an infinite recursion?

Q. How can you stop/resolve an infinite recursion?   Answer =   If we use…

What is infinite recursion? Why does it occur?

Q. What is infinite recursion? Why does it occur?   Answer = A recursive …

Is it necessary to have a base case in a recursive function? Why/Why not?

Q. Is it necessary to have a base case in a recursive function? Why/Why not? …

What is recursive case?

Q. What is recursive case?   Answer =   It is the case that solves the pr…

What is base case?

Q. What is base case?   Answer =    It is the case that causes the recurs…

What are the two cases required in a recursive function?

Q. What are the two cases required in a recursive function?   Answer = 1 …

What is direct recursion and indirect recursion?

Q. What is direct recursion and indirect recursion?   Answer = Direct rec…

What is a recursive function? Write one advantage of recursive functions.

Q. What is a recursive function? Write one advantage of recursive functions. …

Figure out the problem with following code that may occur when it is run?

Q. Figure out the problem with following code that may occur when it is run? …

Consider the following Python function Fn().

Q. Consider the following Python function Fn(), that takes an integer n param…

Load More That is All