insertion and merge sort implementation