insertion sort and sorted merge