You are not logged in. Please login at to post your questions!


Doubt in treap

First of all, isn't treap a self-balancing tree? If so, why isn't there any rotation operations in it?

But in another implementations, I saw the use of rotation

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 <t-> 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

dragonemperor's gravatar image

accept rate: 10%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • 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:


question asked: 23 Aug '15, 19:19

question was seen: 1,209 times

last updated: 23 Aug '15, 19:19