Are treaps slow ?

Revision en1, by svg_af, 2016-02-19 21:39:50

Hello there

so I'm trying to solve this problem

It's about finding the gcd of a set of numbers where i insert and delete numbers from the set

I already solved it with a segment tree, and after learning about treas i tried solving it with a treap but it TLEd on testcase 18

now my question is: aren't treaps on average Log(n)? if so ... shouldn't it pass where segment tree did with complexity of stable Log(n)?

here's my treap code for reference for maybe the error is in my implementation

Tags treap, tle, complexity

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English svg_af 2016-02-19 21:39:50 608 Initial revision (published)