424,294 Members | 1,891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,294 IT Pros & Developers. It's quick & easy.

time complexity

P: 1
Hi everyone!

I've been recently asked by one of my friends to help him out with these two following questions.

1.Find the time complexity of this two piece of code and write which one is bigger?

for( int i=2 ; i<= n; i=i*i )
for( int j=2 ; j <= i; j=j*j )
print(j);


while ( n>1 ){
print(n);
n=n/2;
}



2.An algorithm that takes the roots of two same Binary Search Trees. if the roots are same return TRUE and if not return FALSE.
(corresponding nodes have the same values.)
2 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 981
Variable n is not properly declared in the code you gave, therefore you will probably get no answer, of just incorrect answers.
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.