 The worst-case behaviour can be improved by using a self-balancing binary search tree.Using such a tree, the algorithm has an worst-case performance, thus being degree-optimal for a comparison sort.However, tree sort algorithms require separate memory to be allocated for the tree, as opposed to in-place algorithms such as quicksort or heapsort.