BookRags.com Literature Guides Literature
Guides
Criticism & Essays Criticism &
Essays
Questions & Answers Questions &
Answers
Lesson Plans Lesson
Plans
My Bibliography Periodic Table U.S. Presidents Shakespeare Sonnet Shake-Up
Research Anything:        
History | Encyclopedias | Films | News | Create a Bibliography | More... Login | Register | Help
Not What You Meant?  There are 10 definitions for Heap.

Treap

Print-Friendly
About 1 pages (370 words)

Bookmark and Share Know this topic well? Help others and get FREE products!

In computer science, a treap is a binary search tree that orders the nodes by adding a priority attribute to a node, as well as a key. [1] The nodes are ordered so that the keys form a binary search tree and the priorities obey the max heap order property. The name treap is a composition of tree and heap.

A treap with alphabetic key and numeric max heap order
A treap with alphabetic key and numeric max heap order

Contents

Definitions

The treap was invented by Cecilia R. Aragon and Raimund G. Seidel in 1989, [2] though the authors credit Jean Vuillemin with studying essentially the same data structure in 1980.

  • If v is a left descendant of u, then key[v] < key[u];
  • If v is a right descendant of u, then key[v] > key[u];
  • If v is a child of u, then priority[v] <= priority[u];

During insertion, the value is also assigned a priority. (This priority may be random, in which case the use of a pseudorandom number generator is applicable.) Initially, insertion proceeds in a manner identical to general binary search tree insertion. After this is done, tree rotations are employed to restore the heap property: the in-order traversal sequence is invariant under rotations, so an in-order traversal still yields the same sequence of values. If priorities are non-random, the tree will usually be unbalanced; this worse theoretical average-case behavior may be outweighed by better expected-case behavior, as the most important items will be near the root. Treaps exhibit the properties of both binary search trees and heaps.

Related data structures

When the priority is randomly allocated according to subtree size, the structure is known as a randomized binary search tree or RBST.

References

  1. ^ Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein (2001), Introduction to Algorithms, Second Edition, MIT Press and McGraw-Hill, ISBN 0-262-03293-7
  2. ^ Seidel, Raimund & Aragon, Cecilia R. (1996), "Randomized Search Trees", Algorithmica 16 (4/5): pp. 464-497, <http://citeseer.ist.psu.edu/seidel96randomized.html>

External links

View More Summaries on Treap
 
Ask any question on Treap and get it answered FAST!
Answer questions in BookRags Q&A and earn points toward
discounted or even FREE Study Guides and other BookRags products!
Learn more about BookRags Q&A
Copyrights
Treap from Wíkipedia. ©2006 by Wíkipedia. Licensed under the GNU Free Documentation License. View a list of authors or edit this article.

Article Navigation
Join BookRagslearn moreJoin BookRags




About BookRags | Customer Service | Report an Error | Terms of Use | Privacy Policy