retagged by
478 views
0 votes
0 votes
For (i=1;i<n2;i++).                                                    a[i]=i;
retagged by

1 Answer

1 votes
1 votes

Analysis:

           i=1    2   3   4 .......n

iteration=1   4    9   16.......k2

         sequence is in the form of sum of squares of natural numbers

       so time complexity t(n)=O(n2).

Related questions

4 votes
4 votes
3 answers
1
0 votes
0 votes
1 answer
2
Naveen Pandey asked Jan 8, 2017
487 views
T(n)=2T(log n)+c c is a constant. Base condition is if(n<2) return 1What will be the tightest bound on time complexity?
2 votes
2 votes
2 answers
3
dd asked Sep 25, 2016
495 views
#include <stdio.h int main() { int x,y = 0; //assume a[] as any array. for(x = 0; x < n; ++x) { while(y < n && arr[x] < arr[y]) y++; } return 0; }
0 votes
0 votes
1 answer
4