Mergesort works for linked lists with worst-case O(1) extra space required