McqMate

Q. |
## What is the time complexity of the above code used to reverse a string? |

A. | copies a string to another string |

B. | compares two strings |

C. | reverses a string |

D. | checks if a string is a palindrome |

Answer» D. checks if a string is a palindrome | |

Explanation: the main purpose of the above code is to check if a string is a palindrome. |

1.6k

0

Do you find this helpful?

15

View all MCQs in

Design and Analysis of AlgorithmsNo comments yet

- What is the time complexity of the above recursive implementation used to reverse a string?
- Given a string, you have to find the minimum number of characters to be inserted in the string so that the string becomes a palindrome. Which of the following methods can be used to solve the problem?
- What will be the time complexity of the code 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 space complexity of program to reverse stack recursively?
- What is the time complexity of the above recursive implementation of binary search?
- What is the time complexity of the above dynamic programming implementation of the assembly line scheduling problem?
- In the worst case, the minimum number of insertions to be made to convert the string into a palindrome is equal to the length of the string.
- Consider the string “abbccbba”. What is the minimum number of insertions required to make the string a palindrome?
- Worst case is the worst case time complexity of Prim’s algorithm if adjacency matrix is used?