×

# Doubt in treap

 0 First of all, isn't treap a self-balancing tree? If so, why isn't there any rotation operations in it? https://s3.amazonaws.com/codechef_shared/download/Solutions/LTIME25/Tester/CHEFDTRE.cpp But in another implementations, I saw the use of rotation http://www.sanfoundry.com/cpp-program-implement-treap/ Which one is better for competitive programming? Also, I have a doubt in the following code  void split (pitem t, int key, pitem & l, pitem & r) { if (! t) l = r = NULL; else if (key key) split (t-> l, key, l, t-> l), r = t; else split (t-> r, key, t-> r, r), l = t; }  Shouldn't the split be split (t-> l, key, l, r-> l), r = t; split (t-> r, key, l-> r, r), l = t; Also, is the assignment (r=t and l=t) taking place before split or after it? asked 23 Aug '15, 19:19 893●2●11●35 accept rate: 10%
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×57

question asked: 23 Aug '15, 19:19

question was seen: 1,209 times

last updated: 23 Aug '15, 19:19