ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1100. Final Standings

Why trees are so slow? TLE11
Posted by Alexander (201 - P TNU) 4 Jan 2008 02:08
I use binary trees + lists for sorting, but I got TLE on 11th test.
Why TLE? Tree sorting isn't slowly sort algorithm?!
Re: Why trees are so slow? TLE11
Posted by Lomir 4 Jan 2008 06:30
Do you use balanced trees? Just binnary trees will cetranly TLE.

However you could make random permutation before creating a tree itself, this will prevent the worst case of O(n) height. And keep your tree relatively balanced.