Linear time Cartesian tree data structure construction