Cartesian Tree Facts

A Cartesian tree over an array is a BST on index and a heap on value. More than one of these is true; select every true statement.

A

A treap is exactly a Cartesian tree whose second coordinate is a random priority.

B

The dual invariant forces O(log⁡n)O(\log n) depth on any input, which is why no rebalancing is needed.

C

It builds in O(n)O(n) with a monotonic stack, because each element enters and leaves the right spine at most once.

D

Every subtree spans a contiguous range of the original array.

E

The array must be sorted first, so construction is O(nlog⁡n)O(n \log n).