- Computer Science Engineering (CSE)
- Design and Analysis of Algorithms
- What is the time complexity of the progr...

Q. |
## What is the time complexity of the program to reverse stack when linked list is used for its implementation? |

A. | o(n) |

B. | o(n log n) |

C. | o(n2) |

D. | o(log n) |

Answer» A. o(n) | |

Explanation: as a linked list takes o(n) time for getting reversed thus linked list version of stack will also take the same time. |

View all MCQs in:
Design and Analysis of Algorithms

- Which of the following is considered as the top of the stack in the linked list implementation of the stack?
- What is the space complexity of program to reverse stack recursively?
- What is the time complexity of the above recursive implementation used to reverse a string?
- What will be the time complexity of the code to reverse stack recursively?
- Consider the brute force implementation of the rod cutting problem in which all the possible cuts are found and the maximum value is calculated. What is the time complexity of this brute force implementation?
- Consider the brute force implementation in which we find all the possible ways of multiplying the given set of n matrices. What is the time complexity of this implementation?
- What is the time complexity of the above code used to reverse a string?
- What is the time complexity of the recursive implementation used to find the nth fibonacci term?
- You are given infinite coins of N denominations v1, v2, v3,…..,vn and a sum S. The coin change problem is to find the minimum number of coins required to get the sum S. What is the time complexity of a dynamic programming implementation used to solve the coin change problem?
- Which of the following takes O(n) time in worst case in array implementation of stack?

Login to Continue

It will take less than 2 minutes

Report MCQ