Content deleted Content added
Mildsunrise (talk | contribs) reference Catalan numbers (amount of Cartesian trees) Tags: Reverted Visual edit |
|||
Line 5:
In [[computer science]], a '''Cartesian tree''' is a [[binary tree]] derived from a sequence of distinct numbers. To construct the Cartesian tree, set its root to be the minimum number in the sequence, and recursively construct its left and right subtrees from the subsequences before and after this number. It is uniquely defined as a [[min-heap]] whose [[Tree traversal|symmetric (in-order) traversal]] returns the original sequence.
Cartesian trees were introduced by {{harvtxt|Vuillemin|1980}} in the context of geometric [[range searching]] data structures. They have also been used in the definition of the [[treap]] and [[randomized binary search tree]] data structures for [[binary search]] problems, in [[comparison sort]] algorithms that perform efficiently on nearly-sorted inputs, and as the basis for [[pattern matching]] algorithms. A Cartesian tree for a sequence can be constructed in [[linear time]]. The amount of distinct Cartesian trees of a certain size is given by the [[Catalan number|Catalan numbers]].
==Definition==
|