add merge sort with scala pattern matching