5.Asymptotic Notations and Basic Efficiency Classes

"What is the time complexity of fun()? int fun(int n) { int count = 0; for (int i = 0; i < n; i++) for (int j = i; j > 0; j--) count = count + 1; return count; } "
Theta (n)
Theta (n^2)
Theta (n*logN)
Theta (nLognLogn)
"What is time complexity of fun()? int fun(int n) { int count = 0; for (int i = n; i > 0; i /= 2) for (int j = 0; j < i; j++) count += 1; return count; }"
O(n^2)
O(nLogn)
O(n)
O(nLognLogn)
What is the asymptotic runtime for traversing all nodes in a binary search tree with n nodes and printing them in order?
O(n^2)
O(nLogn)
O(n)
O(nLognLogn)
Suppose we have a O(n) time algorithm that finds median of an unsorted array. Now consider a QuickSort implementation where we first find median using the above algorithm, then use median as pivot. What will be the worst case time complexity of this modified QuickSort.
O(n^2)
O(n^2 Logn)
O(n Logn Logn)
O(nLogn)
0
{"name":"5.Asymptotic Notations and Basic Efficiency Classes", "url":"https://www.quiz-maker.com/Q22EABPI","txt":"\"What is the time complexity of fun()? int fun(int n) { int count = 0; for (int i = 0; i 0; j--) count = count + 1; return count; } \", \"What is time complexity of fun()? int fun(int n) { int count = 0; for (int i = n; i > 0; i \/= 2) for (int j = 0; j < i; j++) count += 1; return count; }\", What is the asymptotic runtime for traversing all nodes in a binary search tree with n nodes and printing them in order?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker