0 votes 0 votes void fun(int n, int k) { for (int i=1; i<=n; i++) { int p = pow(i, k); for (int j=1; j<=p; j++) { // Some O(1) work } } } Time complexity= ? Algorithms time-complexity algorithms + – Surya Dhanraj asked Sep 30, 2017 retagged Jun 11, 2022 by makhdoom ghaya Surya Dhanraj 363 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply sachin! commented Sep 30, 2017 reply Follow Share assuming pow(i,k0 work in O(logk) complexity = 1^k+2^k+------------+n^k + nlogk+n 0 votes 0 votes Surya Dhanraj commented Sep 30, 2017 reply Follow Share time complexity is Θ(n^k+1 / (k+1)) 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes 1^k+2^k......................+n^k+nlogk<=n^k+n^k.................................+n^k=O(n^(k+1)) Nitesh Choudhary answered Oct 5, 2017 Nitesh Choudhary comment Share Follow See all 0 reply Please log in or register to add a comment.