Why do we need backtracking? Discuss with an example. Write and find the time and space complexity of binary search algorithm.
Write Euclidean algorithm to find the GCD of two given integers. Explain the elements of Greedy strategy.
Define tractable and intractable problems with examples. Find the edit distance between the string "CARPET" and "MARKET" using dynamic programming.
Attempt any Eight questions
[8x5=40]Given the dataset {10, 20, 30, 40}, use the backtracking approach to find the subset of elements that equals to the sum 40.
Write the algorithm for Miller - Rabin primality test.
Justify the concept of CNF-SAT with an example.
Solve the recurrence relation T(n) = T(n/2) + 1, T(1) = 1, using iteration method.
Write and discuss the time and space complexity of insertion sort.
Describe in brief about aggregate analysis. Write and discuss about best and worst case for sequential search.
Find max and min element in {5, 7, 3, 4, 9, 12, 6, 2} using divide and conquer approach.
Write dynamic programming approach to solve Floyd Warshall algorithm.
Define recursion. How does Kruskal's algorithm follow greedy approach to find minimum spanning tree? Illustrate with an example.