toros's blog

By toros, history, 6 years ago, In English

Can somebody please help me in finding the error in my code for the problem Qtree.
Spent more than 7-8 hours on this, submitted a total of 14 codes and on every submission I got tle. Could not figure out why.
I don't think there is anything wrong with my logic. The complexity of my solution is also nlog2n. I checked every while loop for infinite iterations; didn't find any. I tried some of the available test cases from spoj toolkit but each of them worked fine. Is there a strict time limit or is there something else that I am missing.
Here is my code.
Necessary comments are added in the code for anyone to understand.

Thanks in advance. Help would be much appreciated...

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it