Analysis of Algorithm Viva QA
Analysis of Algorithm Viva QA
Module 1: Introduction
A: Time complexity is time taken as a function of input size. Space complexity is the memory used.
A: Big-O (O): Worst-case; Omega (Omega): Best-case; Theta (Theta): Tight bound.
A: Selection: O(n²)
A: Merge Sort: O(n log n), Quick Sort: Avg O(n log n), Worst O(n²)
A: O(log n)
A: Finds shortest path from source to all nodes with non-negative weights.
A: Kruskal: Edge-based.
Prim: Vertex-based.
Q: What is LCS?
Q: What is TSP?
A: Finds shortest cycle to visit all cities exactly once and return.
Q: What is backtracking?
Q: Time complexities?
A: Naive: O(nm)
KMP: O(n+m)