Added implementation of cartesian tree