McqMate

Q. |
## Which of the following takes O(n) time in worst case in array implementation of stack? |

A. | pop |

B. | push |

C. | isempty |

D. | pop, push and isempty takes constant time |

Answer» D. pop, push and isempty takes constant time | |

Explanation: functions pop, push and isempty all are implemented in constant time in worst case. |

862

0

Do you find this helpful?

1

View all MCQs in

Design and Analysis of AlgorithmsNo comments yet

- Worst case is the worst case time complexity of Prim’s algorithm if adjacency matrix is used?
- Which of the following is considered as the top of the stack in the linked list implementation of the stack?
- What is the time complexity of the program to reverse stack when linked list is used for its implementation?
- 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 worst case time complexity of KMP algorithm for pattern searching (m = length of text, n = length of pattern)?
- Rabin Karp algorithm and naive pattern searching algorithm have the same worst case time complexity.
- What is the worst case time complexity of a quick sort algorithm?
- The worst-case efficiency of solving a problem in polynomial time is?
- What is the worst case time complexity of dynamic programming solution of set partition problem(sum=sum of set elements)?