1 1 vote The time complexity of the function mentioned below is: void f(int k[], int n) { int i; printf("%d",n); for(i=0; i<n; i++) { printf("%d",k[i]); } printf("n"); } $O(n^2)$ $O(n \log n)$ $O(n)$ $O(n^3)$ Algorithms tbb-algorithms-2 algorithms time-complexity programming-in-c asymptotic-notations + – Bikram 534 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 1 1 vote Time Complexity of a loop is considered as O(n) if the loop variables is incremented / decremented by a constant amount. For example following functions have O(n) time complexity- // Here c is a positive integer constant for (int i = 1; i <= n; i += c) { // some O(1) expressions Akash Pruthi answered Jan 22, 2018 • selected Aug 16, 2019 by Bikram Akash Pruthi comment Share Follow 0 reply Please log in or register to add a comment.