REC_CMPL2 What is the worst case time complexity of the following code:int findMinPath(vector &V, int r, int c) { int R = V.size(); int C = V[0].size(); if (r >= R || c >= C) return 100000000; // Infinity if (r == R - 1 && c == C - 1) return 0; return V[r][c] + min(findMinPath(V, r + 1, c), findMinPath(V, r, c + 1)); } Assume R = V.size() and C = V[0].size(). O(2^(R + C)) O(R*C) O(R + C) O(R*R + C*C) O(R*.. 더보기 GCD_CMPL In the following C++ function, let n >= m. int gcd(int n, int m) { if (n%m ==0) return m; if (n 0) { n = n%m; swap(n, m); } return n; } What is the time complexity of the above function assuming n > m? Θ(logn) Ω(n) Θ(loglogn) Θ(sqrt(n))Good solution:https://www.youtube.com/watch?v=pqivnzmSbq4Euclidean algorithm 더보기 CHOOSE1 CHOOSE1BookmarkSuggest EditWhich of the following is not bounded by O(n^2)? (15^10) * n + 12099 n^1.98 n^3 / (sqrt(n)) (2^20) * nGood solution:The big O gives an upper bound. It doesn’t have to be tight - just means the function won’t exceed it for n > some constant. In this case O(n^2) serves as an upper bound for a, b and d. Functions a and d are linear - more to the order of O(n). Function b .. 더보기 이전 1 ··· 12 13 14 15 16 17 18 ··· 53 다음