implemented merge sort on the linked list