  in computer science, the treap and the randomized binary search tree are two closely related forms of binary search tree data structures that maintain a dynamic set of ordered keys and allow binary searches among the keys. after any sequence of insertions and deletions of keys, the shape of the tree is a random variable with the same probability distribution as a random binary tree; in particular, with high probability its height is proportional to the logarithm of the number of keys, so that each search, insertion, or deletion operation takes logarithmic time to perform. == description == thumb|left|a treap with alphabetic key and numeric max heap order the treap was first described by cecilia r. aragon and raimund seidel in 1989;  its name is a portmanteau of tree and heap. it is a cartesian tree. in which each key is given a (randomly chosen) numeric priority. as with any binary search tree, the inorder traversal order of the nodes is the same as the sorted order of the keys. the structure of the tree is determined by the requirement that it be heap-ordered: that is, the priority number for any non-leaf node must be greater than or equal to the priority of its children. thus, as with cartesian trees more generally, the root node is the maximum-priority node, and its left and right subtrees are formed in the same manner from the subsequences of the sorted order to the left and right of that node. an equivalent way of describing the treap is that it could be formed by inserting the nodes highest-priority-first into a binary search tree withou
Binary_trees Heaps_(data_structures) Probabilistic_data_structures Search_trees