insertion sort
insertion sort using pattern matching