McqMate

Q. |
## What is the advantage of iterative code for finding power of number over recursive code? |

A. | iterative code requires less time |

B. | iterative code requires less space |

C. | iterative code is more compiler friendly |

D. | it has no advantage |

Answer» B. iterative code requires less space | |

Explanation: both iterative and recursive approach can be implemented in log n time but the recursive code requires memory in call stack which makes it less preferable. |

559

0

Do you find this helpful?

4

View all MCQs in

Design and Analysis of AlgorithmsNo comments yet

- Recursive approach to find power of a number is preferred over iterative approach.
- How many recursive calls are there in Recursive matrix multiplication by Strassen’s Method?
- What will be the recurrence relation of the code of recursive selection sort?
- Recursive program to raise an integer x to power y uses which of the following algorithm?
- Which of the following recursive formula can be used to find the factorial of a number?
- What is the number of swaps required to sort the array arr={5,3,2,4,1} using recursive selection sort?
- What is the time complexity of the above recursive implementation used to reverse a string?
- What will be the best case time complexity of recursive selection sort?
- Recursive selection sort is a comparison based sort.
- What is the average case time complexity of recursive selection sort?