A theory of mergesort

Mergesort based on the algorithm used in OCaml. There are two versions.
mergesort_tail uses a tail recursive merge (following OCaml) whereas
mergesort uses a normal merge. Both are stable.

Initial experiments show that mergesort outperforms QSORT and QSORT3
executing with EVAL.

I ran each of the 4 sorts on 3 different lists of 10000 numbers. Call
them SORTED (COUNT_LIST 10000), RAND32 (10000 random 32bit numbers), and
RAND16 (10000 random 16bit numbers). NB, QSORT is not stable whereas
QSORT3 is.

            mergesort      mergesort_tail      QSORT        QSORT3
SORTED       10.9s           13.4s               *            *
RAND32       27.6s           30.7s              33.8s        1m23s
RAND16       18.2s           20.5s              21.4s        55.4s

* QSORT and QSORT3 do not finish on the sorted input for (COUNT_LIST
500) they take 10.8s and 31.4s respectively. This is because quicksort
exhibits its quadratic worst-case behaviour on already sorted inputs.