retagged by
333 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

593
views
1 answers
1 votes
Sajal Mallick asked Nov 28, 2023
593 views
Consider the problem that given a set Sof n integers and another integer x, whether or not there exist two elements in S whose sum is exactly x. What is the worst case ti...
210
views
0 answers
0 votes
306
views
1 answers
0 votes
NeelParekh asked Jul 27, 2023
306 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?
489
views
1 answers
2 votes
h4kr asked Dec 30, 2022
489 views
What is the correct time complexity in $\theta()$ ?