McqMate

Q. |
## What will be the time complexity of the code to reverse stack recursively? |

A. | o(n) |

B. | o(n log n) |

C. | o(log n) |

D. | o(n2) |

Answer» D. o(n2) | |

Explanation: the recurrence relation for the recursive code to reverse stack will be given by-t(n)=t(n-1)+n.this is calculated to be equal to o(n2). |

1.2k

0

Do you find this helpful?

16

View all MCQs in

Design and Analysis of AlgorithmsNo comments yet

- What is the space complexity of program to reverse stack recursively?
- What is the time complexity of the program to reverse stack when linked list is used for its implementation?
- What is the time complexity of matrix multiplied recursively by Divide and Conquer Method?
- What is the time complexity of the above code used to reverse a string?
- What is the time complexity of the above recursive implementation used to reverse a string?
- Which of the following is considered as the top of the stack in the linked list implementation of the stack?
- Matrix A is of order 3*4 and Matrix B is of order 4*5. How many elements will be there in a matrix A*B multiplied recursively.
- What will be the best case time complexity of recursive selection sort?
- What is the average case time complexity of recursive selection sort?
- What is the time complexity of the above recursive implementation of binary search?