Back to the 2022 paper
Similar questions
Design and Analysis of Algorithms Suppose the number of basic operations in an algorithm is defined as: T(n) = T(n-1) + n, with T(1) = 1. Solve this recurrence using the substitution method and determine the time complexity.20247mDesign and Analysis of Algorithms Which of the following best describes space complexity? (i) Time taken by the algorithm (ii) Memory required to run an algorithm (iii) Number of recursive calls (iv) Number of loops used20242mDesign and Analysis of Algorithms Define time complexity and space complexity. Write an algorithm for adding n natural numbers and find the space required by that algorithm.20257mDesign & Analysis of AlgorithmsIn the following C++ function, let n >= m. ``cpp int gcd(int n, int m) { if (n % m == 0) return m; if (n < m) swap(n, m); while (m > 0) { n = n % m; swap(n, m); } return n; } `` What is the time complexity of the above function assuming n > m? - (i) \Theta(\log n) - (ii) \Omega(n) - (iii) \Theta(\log \log n) - (iv) \Theta(\sqrt{n})20192m
PreviousCalculate the time complexity of the following problem using divide and conquer strategies: (i) T(n) = \sqrt{n} \cdot T(\sqrt{n}) + n, \quad n > 2 (ii) T(n) = T(n-1) + 1/n, \quad n > 1NextExplain the working of merge sort algorithm with an example. Give the complexity calculation of merge sort.