retagged by
292 views
0 votes
0 votes
n is prime ,find value of x and find time complexity.

main()

{

x=0;

for(i=1;i<=n;i++)

{

if(n%i)

{

for(j=1;j<=n;j=j*10)

{

x=x+1;

}

}

}

}

what i am getting is x=(n-2)logn

tym complexity =n+(n-2)log n.

is correct ?
retagged by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
2
0 votes
0 votes
1 answer
3
NeelParekh asked Jul 27, 2023
263 views
If an array is split in the form of increasing and decreasing order then what is TC to find minimum element in the array?
2 votes
2 votes
1 answer
4
h4kr asked Dec 30, 2022
432 views
What is the correct time complexity in $\theta()$ ?