By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,601 Members | 1,046 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,601 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.)
Feb 6 '19 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 1,035
Variable n is not properly declared in the code you gave, therefore you will probably get no answer, of just incorrect answers.
Feb 9 '19 #2

Post your reply

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